ranger-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ranger-users] The Configuration File


From: Roman Z.
Subject: [Ranger-users] The Configuration File
Date: Sat, 22 May 2010 02:14:42 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

The configuration files are way too complicated.
Please throw in ideas to make them easier =)

Here are mine:

1. Adhere to the unix philosophy and "do one thing but do it well"
=> Ranger is a file manager, not a file launcher.
Remove apps.py, leave launching of programs to another program.

Since IMO most command line file launchers are too simple for ranger
(they open files in only one possible way), I'd probably write a
standalone file launcher with the features which are currently
implemented by ranger / apps.py

Not sure if this is a good idea.


2. Use eval instead of import
Currently ranger imports the configuration files as if they were
libraries.  This is not very elegant because, well, they are no
libraries.  Especially keys.py, it executes functions on an existing
FM instance, import shouldn't be used here.

If I'd use eval, I could even post-process the config files, e.g.
prepending the "from ranger.api.XYZ import *" so you don't have
to write it in the config file.


3. Merge all configuration files into one, simplify syntax
This is how the config should look like, imo:

# options:
option.colorscheme = "default"
option.preview_files = False

# keybindings:
map(key='dd', context='browser', func=fm.delete())
map('yy', fm.copy())  # dont torture the user and make keywords optional

# apps:
app(name='gnumeric', command='gnumeric %s', flags='d')

def custom_feh_command(context):
    if context.mode is 1:
        return 'feh', '--bg-scale', context.filename
    else:
        return 'feh', context.filenames
app(name='feh', command=custom_feh_command)

option, map and app would simply be references to fm.settings,
fm.env.keymanager.map and a new function which simplifies application
definitions.
We can also make the FM instance available to the user to give him total
control and the freedom to write something like:

fm.exit = lambda self: \
    self.notify("Aww, why do you want to quit? Don't you like me?")

Can't think of anything else now




reply via email to

[Prev in Thread] Current Thread [Next in Thread]