by throwaway053934 · 8y ago · 0 comments
I am not talking about some rarely used keys/functions, but the problem lies at the very core of the experience: the simple hjkl, vim-style navigation.
You see, as in vim, k/j ('up'/'down') obviously move up/down in the list of dirs/files. h ('left') moves up the directory hierarchy ('Parent dir' as nnn's help aptly describes the function.) Of course, now l ('right') moves down the directory hierarchy: IF you are sitting with the highlight on a DIRECTORY entry, obviously if moves down into that directory.
But here is the kicker: what if you have as your current highlight something OTHER than a directory, that is a FILE ?
It OPENS the file. (The open operation is done through xdg-open, so whatever that is configured to recognize) If xdg-open is not configured defensively, in the case when the file is executable it runs the program. Or if the file has some associated program, it is launched with the file as an argument. (this was happening even on my machine, and I have a relatively conservative xdg-open config) At the minimum it launches an editor, opening the file in read/WRITE. In nnn's help, listed among the keys activating this 'Open file/enter dir' is the <Return> key, in addition to the usual move right keys (so 'l' and right arrow). A clear expression that in the authors intention those keys have equivalent functionality.
So imagine you're browsing around the file system as fast as your fingers and eyes allow (after, that's the beauty of the fast text/ncurses interfaces, yes?). You just want to examine stuff, look at files, poke into configurations, maybe for a archive you just downloaded. Archive that might or might not have executable stuff and/or potentially harmful things. You've located the dir path you want to go into, you dive in and before you realize you need to hit the brakes on that 'l' key, you end up moveing RIGHT on SOMETHING (it happened so fast you're not even sure what it was), and that SOMETHING was executed/loaded, now some application is opened, and on top of that you were continuing to type so that application receives your keys and does who-knows-what (well, depending on what was launched).
WTF ??? The first time it happened, I could not believe such a UI design decision: mixing NAVIGATION and OPEN operations on the SAME KEY. OPEN is a sensitive, potentially disruptive operation: there SHOULD be some minimal friction provided in the interface before one is allowed to proceed.
It moved this nnn from potentially one my favorite tools, into a totally love/hate relationship. Yes, "love" because indeed it does some things well. But the mistake of this RIGHT/OPEN snafu is enough to more than cancel any other qualities.
But focusing back on keyboard operation... It is true that many text based file managers do this 'open file on right navigation move'. In my opinion that doesn't make it right: I personally consider a bad thing that can lead to startling, unnecessary and potentially sensitive application launches; a separation between movement (hjkl, arrows) and opening (obvious choice here, <Return>) is a sensible design.
Another point of view: the unwanted file-open-by-mistake situations are a form of involuntary file previews. As nnn's own 'design considerations' state [0], previews are to be avoided: "previewing ... is a wastage", potential "slow/faulty ... access makes the experience very painful" and "Users should see only what they explicitly want to see".
Lastly, there is an important aspect that mitigates the problem for 'most file managers': customization.
Here's a quick glance at the players in this text-fm arena:
- ranger and vifm, the larger managers: a cursory look in their help/configs hints that they can be heavily customized - out of the box ranger displays a preview of the selected file; that acts a big visual hint that you don't need to 'navigate' further; however I agree that default previews are bad - ranger and vifm remember the position along the path, so you don't get shunted moving back down - noice has about the same behavior as nnn (nnn was forked from it), but at least it has a standard suckless style config.h header allowing customization by recompiling - speaking of suckless style, a last resort solution is to do just that with nnn, making your own fork: its header largely keeps the structure of the original
And here are examples that work more along the lines I prefer:
- rover has the best behavior IMO: it can be similarly configured using environment variables, but by default it uses hjkl simply for navigation and NOTHING ELSE; it has separate, dedicated keys for open, preview or other things - midnight commander has the same separation: arrows (actually just up/down) strictly for navigation (in local dir ONLY, no less); explicit directory navigation and opening with <Return>; there is no implicit 'file open'
[0] https://github.com/jarun/nnn/wiki/nnn-design-considerations
Oh, don't worry! I can drop an env var to disable the right-> open file thing.
However, all dirs are listed on top separately and in a clearly different color. How often are you ending up pressing the right on a file? I am surprised because `nnn` has many users and no one ever mentioned this as an issue before!
> dirs ... in a clearly different color
Hey, unless you launch nnn -c 10 I guess ? ;-) Or nnn -l -c 10 and there is even less to distinguish them other than that slash.
> How often are you
Maybe it's the file hierarchy on my machine, but I end up a lot, somehow. One easy example is a deeper path ending with, say, an .odt or .xcf as first entry in the last, leaf directory, e.g. a/b/c/d/e/bigfile.xcf; oops! one extra l and the gimp or libre office start up (for fun, try that on a RPi ;-) As someone else mentioned in the discussion, the intuition is that going up and down the SAME path will take you to the SAME positions in each directory: the example given was "/a/b/c/d -> /a/b/c -> /a/b -> /a/b/c -> /a/b/c/d;". That is not the case in noice/nnn and it can trip you off. To make it more clear, consider this tree:
tmp/a/1b/huge.odt
tmp/a/2b/c/some_other_stuff
You are inside 'c'; you quickly go up 3 levels ('hhh') to glance at the content of 'tmp'; then you go back down 3 levels by quickly tapping 'lll', intuitively expecting to end up in the same place, inside 'c'; instead you'll go in 'a', but then in '1b' on the 'huge.odt' file , then the 3rd l launches libre office...> many users and no one ever mentioned
selection bias or how do you call this effect ? People that are bothered by this simply moved away and didn't mention a thing ?
Anyway, thanks again.