Closed jarun closed 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.
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.
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. :(
The 3rd issue should be fixed at commit 81318f9218adaeae3044d1d93ee4700cb056752d.
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.
pressing Enter should go back
I might be missing something... pressing Enter always opened the file or dir... even in filter mode.
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.
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.
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.
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.
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.
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!
@lawnowner archive selection is available at commit d9977c5ea1c4401f2d7981ba30baeda8aa4015a3.
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.
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.
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!
That would be great! Please let me know if you need any help.
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:
abc 1
abc 2
abc 10
nnn
sorts it like so:
abc 1
abc 10
abc 2
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?
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:
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.
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.
strverscmp()
places capitals on top. We really don't want that. No one remembers if a file name starts with a
or A
.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.
@DavideSilva sure thing! Could you kindly raise a PR? Please feel free to ask if you need any help.
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?
We have two keys mapped to leader - ^/ and `. Do you have the second one (backquote) in your keyboard?
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: + - . , \< ´ ^ #
, it is! ;)
@Garzet version sort is in on master at commit 336eca300a3ed466172b1ca67bc610f230267053! Please let me know how it goes.
@DavideSilva & @breisa comma replaces backquote as leader key at commit f21ec611cd648d7a340a7d02ad442a4fa7ac96c4.
Have multiple contexts open and try comma comma, comma dot. ;)
@jarun Thank you, works like a charm. :+1:
@breisa awesome!
@Garzet version sort is in on master at commit 336eca3! Please let me know how it goes.
Works perfectly! Thanks!
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.
Thanks for the try!
@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.
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
Does support file picker mode
mean providing a file chooser dialog similar in GTK and QT?
@amosbird in picker mode, nnn
opens and you can select one or multiple files.
Is it possible to act as a file dialog and possibly replace the Gtk/Qt ones system-widely?
Nope.
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.
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.
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 :)
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.
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.
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.
@retipuj sorry, nnn
visual design would remain single-column.
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.
Rolled from #137.
Ready for next release (master-only)
Proposed and completed features
nnn
as a file picker with picker.sh-s
)-n
)N
(1 <= N <= 4) to switch to context NNNN_OPENER
to specify file openerNNN_NOTE
and keybind ^N for quick notesdu
modemimeopen
)$EDITOR
,$PAGER
and$SHELL
fore
file removalNNN_USE_EDITOR
is setl
keys)nnn
as a file picker within vimnlay
(no more used bynnn
)$TMPDIR
if availablepatool
get_coolsize()
(thanks @arsv)NNN_NOWAIT
to unblock nnn (DE specific)xdg-open
on Linux andopen(1)
on OS X as desktop openernlay
vlock
as default terminal screensavernlay
- a shell script for actions like open desktop search utility, run screensaverless
Q
to quit to current dir (needs external shell integration)^Q
to quit (even from filter mode)-
to jump to last directory~
(HOME) at chdir prompt~ (feature removed)lstat()
details)NNN_COPIER
)Up
andDown
at the first and last entriesAnything else which would add value (please discuss in this thread)