Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory specific options #171

Closed
psnszsn opened this issue May 24, 2019 · 5 comments
Closed

Directory specific options #171

psnszsn opened this issue May 24, 2019 · 5 comments

Comments

@psnszsn
Copy link

psnszsn commented May 24, 2019

Sorry if this has been discussed before, but i could not find any reference to it.

Is there a way to set directory specific options?
Examples:

  • sort the downloads directory by date
  • show hidden files in specific directories

In ranger this is accomplished with setlocal path=/path options.

@gokcehan
Copy link
Owner

@psnszsn I think this is a duplicate of #117. We currently do not have a way to set local settings for directories.

@JurisMajors
Copy link
Contributor

Are there any plans for this?

I don't know how this would get parsed within a config, however, is it any more complicated than just having a mapping from path to command (string to string) and then executing this command whenever you cd in a directory that is in this mapping as a key?

@gokcehan
Copy link
Owner

@JurisMajors I haven't given this much thought but I'm guessing this is not trivial to implement. We need to add a new keyword such as setlocal to the parser, keep these special configurations within a map, and use these whenever we use a value of an option. We probably need to touch almost everywhere in the codebase to implement this. I'm not saying it is impossible but it is not quite easy either.

@reg-iii
Copy link

reg-iii commented Jul 28, 2020

Any chance we'll ever see this? It would be nice to display the contents in my home folder in alphabetical order and my downloads in reverse chronological order...

@gokcehan
Copy link
Owner

gokcehan commented Aug 1, 2020

@reg-iii The ratio of requests/contributors is still pretty high. I would say your best bet is to work on this yourself, and optionally send a PR when you feel confident about it.

If anyone is interested in working on this, it seems that everything mentioned here is about sorting (including hidden, dirfirst, reverse). We already have a representation of this in the code as sortType. Every dir has a sortType and we check this value against gOpts.sortType whenever we load the directory. There aren't many of these checks.

I guess the more tricky part is to add a new type to the parser and the evaluator. There should be a new keyword in the lexer (i.e. setlocal), a new rule in the parser (i.e. SetLocalExpr = 'setlocal' <dir> <opt> <val> ';'), and the corresponding func (e *setLocalExpr) eval(app *app, args []string) implementation in the evaluator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants