Closed Oxore closed 3 months ago
I remember asking for something similar a couple years ago but @jarun didn't like it and said there was some reason to not do it. Don't remember the specifics on why.
I am really looking forward to know why it shouldn't be done this way or shouldn't be done at all.
From https://github.com/mcchrish/nnn.vim#explorer:
Pressing l or Right on a file would open it instead of picking. Use -o via nnn#command to disable this.
Any change to l
also does the same with Right
. I am fine with l
. But does picking a file with Right
seem to be the correct behaviour?
Any change to l also does the same with Right. I am fine with l. But does picking a file with Right seem to be the correct behaviour?
At least this behaviour is consistent with the usual navigation mode. If you ask me, I think this is correct.
From https://github.com/mcchrish/nnn.vim#explorer:
Pressing l or Right on a file would open it instead of picking. Use -o via nnn#command to disable this.
Uh-oh... I just realized that the current implementation in the PR renders the -o
option ineffective in the picker/fifomode. Assuming that the use case of the -o
option is not only for the picker/fifomode, this is an obvious conflict. I will update the PR to fix this conflict.
/root/project/src/nnn.c:6768:13: error: function 'browse' exceeds recommended size/complexity thresholds [readability-function-size,-warnings-as-errors]
static bool browse(char *ipath, const char *session, int pkey)
^
/root/project/src/nnn.c:6768:13: note: 953 statements (threshold 950)
Apparently the browse
function is perfectly balanced in terms of statement count and I just exceeded the quota, according to the CI. Don't know what to do with this at the moment, but I find it funny.
It turns out there is a use case for opening a file in picker mode (see https://github.com/jarun/nnn/pull/1832#discussion_r1539935256) and this PR breaks it. I would like to close this PR for now. I should think about making the new behavior optional.
This enables a user to pick files by pressing
l
key when using nnn as a picker or in fifomode, which is used by vim plugins such asmcchrish/nnn.vim
andluukvbaal/nnn.nvim
. It also prevents nnn from opening a file whenl
key is pressed, which is unexpected and unwanted behavior form the user's perspective (IMO).I explained the use case in #1827 (so not going to copy-paste or rewrite it here) and also tried to discuss whether it is acceptable to make nnn pick files by pressing
l
in a way which I am presenting in this PR, but I guess it turned out to be vague, so I decided to straight file a PR to show what I want.