jarun / nnn

n³ The unorthodox terminal file manager
BSD 2-Clause "Simplified" License
19.35k stars 761 forks source link

ToDo list #202

Closed jarun closed 5 years ago

jarun commented 5 years ago

Rolled from #137.

Ready for next release (master-only)

Proposed and completed features

Anything else which would add value (please discuss in this thread)

lawnowner commented 5 years ago

Here is a compact version of nnn config:

Go up/down/in/out/top/bottom            k/j/l/h/g/G
Scroll up/down                          Ctrl-u/Ctrl-d
Go to home/previous/start dir           ~/-/&
Filter entries                          /
Toggle nav-as-you-type mode             Ctrl-t
Pin dir/Go to pinned dir                b/Ctrl-b
Go to context #/next                    {1-4}/Tab
Quit context/nnn/nnn and cd             q/Ctrl-q/Ctrl-g
.......................................................
Toggle show hidden entries              .
Toggle du in allocated/apparent size    Ctrl-j/S
Toggle sort by size/modification time   s/t
Show entry details                      D
Show brief/full media info              m/M
.......................................................
Create file/dir/links to selection      n
Rename entry/all entries                Ctrl-r/r
Toggle multi-selection mode             Ctrl-y
Select entry/all entries                Space/Y
List current selection                  y
Copy/move selection                     P/V
Delete entry/selection                  Ctrl-x/X
Extract/create/list archive             Ctrl-f/f/F
Open file in EDITOR/PAGER               e/p
Open file with...                       Ctrl-o
Execute file                            C
Run custom script                       R
Spawn SHELL in dir                      !
Clear/exit prompt                       Ctrl-l/Ctrl-[
Show help and volume free/total space   ?

I think archiving should apply to selection, and navigating with <h,j,k,l> instead of arrows should be possible after filtering a directory listing and hitting Enter. Right now, I use Ctrl-u after filtering with / before I can use <h,j,k,l>. There also seems to be a strange timing issue when a directory listing is filtered, but it happens only at the first time whereas subsequent filters in the same directory seem to be alright: I go in videos dir and type /2017, press <down> arrow once, and wait on the entry for about a second, then the list automatically returns to the unfiltered state while the selected entry is preserved.

jarun commented 5 years ago

Simply awesome! I had been looking for a concise listing to save memory. :+1: Many thanks!

I think archiving should apply to selection

The problem is the archiver is third party utility and not each one follows the same syntax. And then passing a variable list to exec() is trouble. So the use case now we have is to select the files, copy/move them to a dir and archive that dir.

Right now, I use Ctrl-u after filtering with / before I can use <h,j,k,l>

Instead of Ctrl-U you can press Esc to escape the filter prompt.

it happens only at the first time

I will check this. I can reproduce it.

jarun commented 5 years ago

I think some entries are missing e.g., ^K. Also, now I am myself finding it difficult to figure out a key from the list. Everything seems too close for comfort. :(

jarun commented 5 years ago

The 3rd issue should be fixed at commit 81318f9218adaeae3044d1d93ee4700cb056752d.

lawnowner commented 5 years ago

The 3rd issue should be fixed at commit 81318f9.

Yes!

So the use case now we have is to select the files, copy/move them to a dir and archive that dir.

This does the job just as good, thanks.

I think some entries are missing e.g., ^K. Also, now I am myself finding it difficult to figure out a key from the list. Everything seems too close for comfort. :(

Yeah, I omitted four shortcuts, picked only one when there are alternatives, and used my usual dense notation; easier for me to commit to memory this way, but bad for documentation :] I just put it here so that maybe some other people benefit.

Instead of Ctrl-U you can press Esc to escape the filter prompt.

When I press Esc at the filter prompt, the filtered list is lost, i.e. the list goes back to the unfiltered state. I think after typing /pattern at the filter prompt, pressing Enter should go back to navigation so that <h,j,k,l> can be used. If I'm not mistaken, v1.6 was working like that.

jarun commented 5 years ago

pressing Enter should go back

I might be missing something... pressing Enter always opened the file or dir... even in filter mode.

lawnowner commented 5 years ago

Just checked, and indeed Enter opens the entry in v1.6; I remembered its behaviour was exiting the filter prompt because the entries I tried in the past were all files and there wasn't programs associated with their mimetypes on that system. Now that aside, <h,j,k,l> navigation in a filtered list should be possible I think. Right now I can only use arrows, or Ctrl-u to leave the filter prompt before <h,j,k,l> navigation works, because Esc cancels filter.

jarun commented 5 years ago

When you press h/j/k/l that becomes a part of the filter string. So pressing any of up/down arrow is the way to do this.

lawnowner commented 5 years ago

Alright then. Although Ctrl-u is a bit of a hack, there is an alternative to arrows that is closer to the home row. Thanks.

jarun commented 5 years ago

Yes, the keyboards/keypads differ among form factors so it's really a difficult call to favour one against the other. I generally try to keep things easier for the Termux users on Hacker's keyboard (I am one of them). For regular keyboard users, life is much simpler.

jarun commented 5 years ago

BTW, I have made the help a little more concise now without sacrificing visibility... space is the separator now and I could reduce a column of text.

lawnowner commented 5 years ago

Hacker's keyboard

I understand. If only people could stay away from "smart" mobile devices. But a lot of water under the bridge since 1874 for qwerty/hjkl...

BTW, I have made the help a little more concise now without sacrificing visibility... space is the separator now and I could reduce a column of text.

New config has the visible advantage of looking the same. It's just that a more concise functional grouping seem to always help me for some reason.

Thanks again for this smooth fm!

jarun commented 5 years ago

@lawnowner archive selection is available at commit d9977c5ea1c4401f2d7981ba30baeda8aa4015a3.

zQueal commented 5 years ago

Any chance of seeing a Windows variant? There are some locations where I'm required to use Windows, and of course I use Vim for convenience. I'd like to switch to nnn, but for it to only be available part of the time is a hurdle.

jarun commented 5 years ago

You can use nnn on Cygwin and Linux subsystem for Windows.

There is an item to compile nnn with PDcurses for native support. Unfortunately I don't own a Windows box.

zQueal commented 5 years ago

You can use nnn on Cygwin and Linux subsystem for Windows.

Cygwin is pretty cancerous, and working with LSW is more of a pain than just not using Vim.

I'll attempt the native option.

Thanks!

jarun commented 5 years ago

That would be great! Please let me know if you need any help.

Garzet commented 5 years ago

I love nnn, but comming from ranger I miss better sorting by name when there are numbers in the name. I often name my files like so:

nnn sorts it like so:

Ranger would sort this the way I expect (1, 2, 10). The same wrong sorting is happening when file name starts with numbers but does not only contain numbers (i.e. 1 abc). I could change my file naming habits and start naming files with leading zeroes, but I would rather not :) Is there a reason why numeric sort only works when filename contains only numbers?

jarun commented 5 years ago

The same wrong sorting

It's implemented that way. Only pure-numeric names are sorted in numeric order.

Is there a reason why numeric sort only works when filename contains only numbers?

Take a look at issue #190.

I see the following problems:

  1. The version sort is probably slower. Let's say we want to compare abc 10 and abc 2. strcoll() would compare 5 characters each but strverscmp() would also check the last character in the first string. nnn strives for speed. When you are having a directory of 10000 similar files this overhead may matter.

  2. The other problem is strverscmp() is non-portable. We can, however, bypass that. The source code is available:

The Android and uClibc versions are similar so I believe it applies to embedded devices.

  1. strverscmp() places capitals on top. We really don't want that. No one remembers if a file name starts with a or A.
DavideSilva commented 5 years ago

Any chance of adding the comma key to be a Leader key? The current options are impossible to use for those of us who do not have an US keyboard layout.

jarun commented 5 years ago

@DavideSilva sure thing! Could you kindly raise a PR? Please feel free to ask if you need any help.

DavideSilva commented 5 years ago

I was but now that I tried the master version, I think my need for adding the comma key as leader as disappeared. My motivation was to be able to switch contexts but that will be possible using the 1-4 keys.

I've only just found this so I'm not at all familiar with all the features nnn has but from the help menu I can only see the Leader key being used to create/switch contexts.

@jarun Do you think it is still worth it to had the comma key as a Leader?

jarun commented 5 years ago

We have two keys mapped to leader - ^/ and `. Do you have the second one (backquote) in your keyboard?

breisa commented 5 years ago

I don't know what keyboard layout @DavideSilva is using, but for example on a german keyboard the current leader-number combinations are impossible too. There are / and ` keys, but to get them you have to press Shift wich prevents you from entering a number at the same time. (e.g. Shift + 4 = $) A leader key that is accessible without pressing a modifierer key would be a better choice. Examples for such a key in the german keyboard layout would be: + - . , \< ´ ^ #

jarun commented 5 years ago

, it is! ;)

jarun commented 5 years ago

@Garzet version sort is in on master at commit 336eca300a3ed466172b1ca67bc610f230267053! Please let me know how it goes.

jarun commented 5 years ago

@DavideSilva & @breisa comma replaces backquote as leader key at commit f21ec611cd648d7a340a7d02ad442a4fa7ac96c4.

Have multiple contexts open and try comma comma, comma dot. ;)

breisa commented 5 years ago

@jarun Thank you, works like a charm. :+1:

jarun commented 5 years ago

@breisa awesome!

Garzet commented 5 years ago

@Garzet version sort is in on master at commit 336eca3! Please let me know how it goes.

Works perfectly! Thanks!

zQueal commented 5 years ago

Wasn't able to get native to compile. I suspect my Windows environment is... Well, it's Windows. I'll leave it at that.

I'll eventually try this again.

jarun commented 5 years ago

Thanks for the try!

norcalli commented 5 years ago

@jarun something to consider is the atool utility for archives, which already does the work of trying to monomorphize the interface to interacting with archives. http://www.nongnu.org/atool/

Also, I'm interested in perhaps adding support for ssh browsing, but my C is a bit rusty, so it might be a while.

jarun commented 5 years ago

nnn works with atool / patool already - https://github.com/jarun/nnn#utility-dependencies.

lftp is my preferred way to go for remote transfers - https://github.com/jarun/nnn/wiki/simplify-remote-transfers-with-lftp

amosbird commented 5 years ago

Does support file picker mode mean providing a file chooser dialog similar in GTK and QT?

jarun commented 5 years ago

@amosbird in picker mode, nnn opens and you can select one or multiple files.

amosbird commented 5 years ago

Is it possible to act as a file dialog and possibly replace the Gtk/Qt ones system-widely?

jarun commented 5 years ago

Nope.

maciejjan commented 5 years ago

Hi, I'm about to switch from ranger, but the way quit-and-cd is implemented bothers me: I often forget to press C-g and press q instead. Wouldn't it be more convenient to always update $NNN_TMPFILE on quit? (Of course if the environment variable is set.) I mean, if I want to change the directory, I have to call nnn through a special Bash function (that sources $NNN_TMPFILE afterwards) anyway, so additionally telling nnn about this fact seems redundant to me.

jarun commented 5 years ago

Of course if the environment variable is set.

$NNN_TMPFILE specifies the tmp file where nnn should write the last visited dir if the user chooses to cd on quit. The intention of the user is confirmed by ^G. Exporting the variable in no way it means the user always wants to drop into the last visited directory on quit.

Did you think the other way? What if a user (like me) has the variable set but (s)he doesn't want to end up into the last directory unless (s)he specifically indicates? How do you handle that?

I believe this is well-documented. Also if it helps, the G in ^G stands for Go.

And q is meant to quit the current context, not the program unless that's the last context left.

Getting familiar to a keybind is a matter of habit and not about remembering a keybind. :wq is not that simple to remember.

maciejjan commented 5 years ago

What if a user (like me) has the variable set but (s)he doesn't want to end up into the last directory unless (s)he specifically indicates?

You won't. You only end up in this directory if you call nnn through a function like n() in scripts/quitcd/. If you call this function, you're already indicating that you want to use cd on quit, so from my point of view it is redundant to have to indicate it again while quitting.

If you call nnn directly and press the keybinding for 'quit and cd', it writes the last visited directory to $NNN_TMPFILE, but won't cd there. I see no harm in having this behaviour by default on every quit.

I believe this is well-documented.

Sure it is. I had no problem understanding how it works, I would just prefer it to work slightly differently. But if you don't agree, I can simply patch it for myself - the program is so minimal that changing it to fit one's personal taste is easy :)

jarun commented 5 years ago

You only end up in this directory if you call nnn through a function like n()

Exactly. I have that in my rc and I don't want to cd on quit every time. I like the brevity of having to type just n to start.

I would just prefer it to work slightly differently

I would really appreciate that! Kindly share the patch if possible. There's another user who wanted that.

the program is so minimal

And it would remain so. I plan to make the libreadline dep configurable too.

jarun commented 5 years ago

libreadline can now be dropped as per commit a8388ab60b0dda80002fa890a891d86e4fb440b0. The stock prompt would be used (no history or completion) but saves several KBs of memory at runtime.

retipuj commented 5 years ago

Is it possible to view the contents of the currently selected directory in an extra column without having to enter this directory (like the default in ranger, for example)? That would be a neat and very useful feature.

jarun commented 5 years ago

@retipuj sorry, nnn visual design would remain single-column.

jarun commented 5 years ago

Just to explain a bit more on the decision...

I think it's very evident from the README that the priority of nnn is to remain a lean and low resource/power consuming utility to navigate the filesystem and help with regular activities of people who have to spend a lot of time in the terminal but don't want to miss out on the GUI applications.

nnn uses unfragmented memory in chunks to store information of files in the current dir. If it needs more it has to re-allocate because the amount of memory required cannot be determined beforehand.

Here's my /usr:

[1 2 3 4] /usr

 2019-02-22 05:56        /  bin/
 2018-10-21 08:47        /  games/
 2019-01-25 06:28        /  include/
 2019-02-10 17:10        /  lib/
 2018-11-03 18:16        /  lib32/
 2016-08-08 20:40        /  local/
 2019-02-22 05:56        /  sbin/
 2019-02-09 07:23        /  share/
 2019-02-02 14:39        /  src/

With the proposed interface, if a user wants to navigate to /usr/share he would have to load /usr/bin which on my system has 2078 files. This would need several consecutive re-allocations. How many files in usr/share? 288, which is roughly 9% of the memory that would get allocated.

That's not the end of it. He would also have to load 6 more directories (the files within each) making unnecessary disk accesses and wasting CPU time and power. He wouldn't even look into those!

Behind every design decision I make, there is a primary question - which purpose does it serve for the primary goal of the utility?

If I wanted to write a multi-pane file manager, I wouldn't have been using only ONE window in nnn so far - the default one. I would have added one for previewing files or images, one for side by side comparison of directories and so on... but there are plenty of file managers that do that.

Perhaps, when you consider enhancing the capabilities of nnn, think of nnn as an ISR, your extended use-case being the bottom half. You would probably appreciate what nnn delivers.