ranger-users
[Top][All Lists]
Advanced

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

Re: [Ranger-users] The Configuration File


From: David Woodfall
Subject: Re: [Ranger-users] The Configuration File
Date: Sat, 22 May 2010 08:44:18 +0100
User-agent: Mutt/1.5.19 (2009-01-05)

On (02:14 22/05/10), Roman Z. <address@hidden> put forth the proposition:
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.

You could use .mailcap or .mime.types I guess but that would involve
parsing those files. It would also mean missing/broken
mailcap/mime.types would need be fixed.

To be honest I'm quite happy with the apps.py file although I'm very
new to python.


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?")

Ok sounds good. It would be nice to have simplified settings. Also
somewhere a list of all possible builtin commands too.



Can't think of anything else now



--
Don't look back, the lemmings are gaining on you.

Attachment: pgp5jX3GNHU1h.pgp
Description: PGP signature


reply via email to

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