Nnn: ToDo list

Created on 24 Nov 2018  路  42Comments  路  Source: jarun/nnn

Rolled from #110.

Ready for next release (master-only)

  • support file picker mode
  • create a repo of user-contributed scripts
  • fixed CJK character handling at prompts
  • support substring search for filters
  • create sym/hard link(s) to files in selection
  • show symlinks to dirs along with dirs in top
  • key N (1 <= N <= 4) to switch to context N
  • bring back NNN_OPENER to specify file opener
  • support NNN_NOTE and keybind for quick notes
  • support multiple arguments in VISUAL/EDITOR
  • key ^B to visit pinned directory
  • additional key ^V to run or select custom script
  • use libreadline for command prompt
  • reduce delay on Esc press
  • config option to avoid unexpected behaviour on 0-byte file open (see #187)
  • rename config option DISABLE_FILE_OPEN_ON_NAV to NNN_RESTRICT_NAV_OPEN
  • keys removed - $, ^, Backspace, ^H, ^P, ^M, ^W

Proposed and completed features

  • [ ] support command completion with libreadline
  • [ ] support soft delete to _reclycle bin_
  • [ ] vertical split pane (discussion required)
  • [ ] compile with PDCurses
  • [x] support custom opener (e.g. mimeopen)
  • [x] run a command (or launch an application)
  • [x] a new demo video (see #167) (thanks @Kallinteris-Andreas)
  • [x] choose script to run from a script directory (see #127)
  • [x] shortcut to run current file as script
  • [x] support a _combined_ set of arguments to $EDITOR, $PAGER and $SHELL
  • [x] remote connection and file transfers (using lftp)
  • [x] per-context directory color
  • [x] support for Cygwin env
  • [x] offer to fore file removal
  • [x] support selection across directories and contexts
  • [x] parse EDITOR or VISUAL for options when NNN_USE_EDITOR is set
  • [x] option to disable file open on navigation (Right Arrow and l keys)
  • [x] vim plugin to use nnn as a file picker within vim
  • [x] retire nlay (no more used by nnn)
  • [x] integrate static analysis on Travis
  • [x] list currently copied files
  • [x] option to disable directory auto-select
  • [x] use $TMPDIR if available
  • [x] support terminal locking on OS X (bashlock) and BSD (lock)
  • [x] support patool
  • [x] run any number of scripts
  • [x] prefer VISUAL over EDITOR
  • [x] add a keybind to run a custom script (see #79)
  • [x] integer get_coolsize() (thanks @arsv)
  • [x] batch rename, move, delete files with vidir integration
  • [x] copy file paths when X is unavailable
  • [x] support copying multiple file names to copier
  • [x] add open with... shortcut
  • [x] add option to open bookmark directly
  • [x] optimize memory usage and algorithms for file name handling
  • [x] list and extract archives
  • [x] show current selection number along with total entries in dir
  • [x] support NNN_NOWAIT to unblock nnn (DE specific)
  • [x] file and directory creation
  • [x] change to light mode if number of cols < 35
  • [x] in-place file rename
  • [x] watch out for current dir changes (if not in filter or du mode)
  • [x] pin and jump to a directory
  • [x] show vol capacity and vol free in help
  • [x] option to use exiftool instead of mediainfo
  • [x] option to show dirs in custom color (default: enabled in blue)
  • [x] show dir content size and number of files in du mode
  • [x] support bookmarks string
  • [x] add option to support opening text files in EDITOR
  • [x] use xdg-open on Linux and open(1) on OS X as desktop opener
  • [x] support multiple apps in nlay
  • [x] use vlock as default terminal screensaver
  • [x] navigate-as-you-type mode
  • [x] subtree search (using gnome-search-tool or catfish)
  • [x] support custom nlay
  • [x] search-as-you-type at filter prompt
  • [x] RPM packages for RHEL/CentOS (thanks @fennm)
  • [x] ~support cd ..... (with . as PWD, stops at /)~ (feature removed)
  • [x] jump to initial directory (where nnn was started)
  • [x] nlay - a shell script for actions like open desktop search utility, run screensaver
  • [x] show file details, mediainfo output, help in less
  • [x] show media information (needs mediainfo)
  • [x] ~support readline at chdir prompt~ (feature removed)
  • [x] use Q to quit to current dir (needs external shell integration)
  • [x] use ^Q to quit (even from filter mode)
  • [x] UTF-8 support
  • [x] add option to start in disk usage analyzer mode
  • [x] open current dir in desktop file manager
  • [x] disk usage analyzer more
  • [x] show unprivileged free blocks in du mode
  • [x] shortcut - to jump to last directory
  • [x] ~resolve ~ (HOME) at chdir prompt~ (feature removed)
  • [x] option to show complete stats of just the current entry (name, file type, human readable permission string, byte size... all lstat() details)
  • [x] update noice man page
  • [x] sort entries by size
  • [x] support file path copier script (NNN_COPIER)
  • [x] support detail view (default)

    • [x] file type

    • [x] modification time

    • [x] human-readable file size

    • [x] current item in reverse video

    • [x] full name of currently selected file in bottom "bar"

  • [x] roll navigation with Up and Down at the first and last entries
  • [x] remove restriction on visiting parent dir when opened with a relative dir path
  • [x] case insensitive alphabetic content listing
  • [x] generate optimized binary
  • [ ] ~show total number of files in du mode~ (apparently it has to be counted in nftw callback, with adjustments like file type check, hardlink check, which means unreasonable overhead)
  • [ ] ~threaded/multicore nftw(3)~ (overkill, we are already very fast)
  • [ ] ~use scandir instead of readdir~ (we are using custom alphanum sort, see https://github.com/jarun/nnn/commit/691291245a88d1c2277d8900a13f41b00685a72c)
  • [ ] ~modify packagecore.yml and probably Makefile to generate OpenSUSE Leap package~

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

Most helpful comment

@jarun Roger. Already my fm of choice, well-crafted to the detail--all I could think were link creation and percent-progress for copies. I doubt I'll use another fm, although my contribution may take a while. Thanks.

All 42 comments

@jarun what do you think of putting the vim plugin to its own repo? It can make installation easier for plugin manager.

@mcchrish I would be more than happy! Would you be kind enough to maintain it? (I don't see too many changes coming).

@jarun not well-versed with vimscript but if no one hasn't done it yet I'll take a look.

@jarun https://github.com/mcchrish/nnn.vim

So for vim-plug just:

Plug 'mcchrish/nnn.vim'

Thanks for the awesome tool!

Awesome! I am retiring the plugin from my project and linking to yours. ;)
Many thanks!

@jarun Hi!

What do you think about having a configuration file?

like $HOME/.config/nnn/nnn.conf

@gabyshev no plans as of now. nnn tries to get the settings from env variables instead of reading a file from the disk. Also, there are not too many config points designed for nnn.

Hi! I was using the latest version, and I'd like to suggest that every time copy/move/list selection is called, nnn read the selected files from ~/.nnncp. Consider this workflow:

  1. open two instances of nnn;
  2. in one of them, go to some directory and select a file;
  3. in the other instance, go to another directory, and then copy (or move) the file selected in step 2.
    This would be useful for people emulating a 'two-panel mode' with tmux.

It works just like that even now. Here's what I tried (with lastest master):

  • in first instance, selected a file with ^K.
  • in second instance, used P to paste the file

The list selection works differently though. Listing is purely a local copy for the specific instance till you write the selection to .nnncp using the last ^Y. Listing is for the user to know which files (s)he has added to the selection list so far.

Nice! Indeed, it works. What confused me was this different behaviour of list selection (I use it to check which files are being changed). Anyhow, thanks for your latest additions into nnn.

No problem!

What about having env var for dir color ?
I mean, if you already have at least one env var why don't have 10 or more ?
Maybe I don't see a difference having 1, 5, 10 or 20 but there's one...

Anyway, default blue doesn't work for me, kinda silly to look at man each time I start nnn to see the arg for it and then the number for let's say red.

@kajzersoze how about using an alias? I do the same.

@jarun didn't occur to me for some reason, good idea :)

patching it is also not a bad idea, I guess what I need is in this line :
https://github.com/jarun/nnn/blob/master/src/nnn.c#L3627

Okay, thanks.

No problem!

First off congrats for this project, I've been test-driving it for the past few hours and looks pretty slick! Coming from graphical file managers (mainly Nautilus), the only thing that seems less efficient and hard to get used to so far is the copy/move/delete actions. Perhaps it's "just" the power of habit but I'd love to be able to have the same UX if possible, at least for the path selection:

  • ^space selects a single path, just like ^K in nnn.
  • To select multiple paths, press _and hold_ ^ while moving up/down to other entries and press space for those to be added to the selection. The selected entries should be displayed with a different background color instead of having to press a shortcut (y) to see the list.
  • As an extra handy shortcut, holding Shift instead of ^ and moving only up or only down selects a consecutive list of entries, without having to press space for each one.

For deletion provide two modes:

  • A "soft" delete (del) that just moves the selected entries to the recycle bin (or equivalent location in other OS).
  • A hard delete (Shift+del) that actually removes the entries (after a Y/N confirmation dialogue).

As for copy and move, I guess I could get used to the different UX - "Copy selection" instead of "Copy and paste" (^C ^V) and "Move selection" instead of "Cut and paste" (^X ^V) - but would be nice to have as well.

Please note that nnn doesn't only cater to desktops.

^space selects a single path, just like ^K in nnn

There's a reason a key is kept without ^ and another with it. It's very difficult on handhelds to use a ^ combination. And for people who use the _navigate-as-you-type_ mode ^ is a must.

To select multiple paths...
As an extra handy shortcut...

Same reason as above. Multiple combinations are very difficult to use on smaller form factors.

For deletion provide two modes

We can have this as an enhancement.

Interesting point about handhelds, it didn't occur to me this was a use case and didn't see it mentioned in the design considerations. Though I'm not sure I'm reading

It's very difficult on handhelds to use a ^ combination. And for people who use the navigate-as-you-type mode ^ is a must.

correctly; are you saying it's very difficult on handhelds to use the navigate-as-you-type mode?

didn't see it mentioned in the design considerations

From the introduction - _It runs on Linux, macOS, BSD, Cygwin, Linux subsystem for Windows and Termux._

are you saying it's very difficult on handhelds to use the navigate-as-you-type mode?

yes, and not because of nnn.

Hi, how can I create (symbolic) links for a selection? maybe 's' and 'h' as options in addition to 'f' and 'd' in 'n' prompt?

@lawnowner this is not a very regular use case. Please use scripts.
Would be great if you can share so I can add it to the scripts directory.

@jarun Roger. Already my fm of choice, well-crafted to the detail--all I could think were link creation and percent-progress for copies. I doubt I'll use another fm, although my contribution may take a while. Thanks.

Hello @jarun. Sorry if this has been asked before, but are there any plans for adding some bulk rename support (e.g. the one from ranger)? If not, would this be easy to implement with a script?

vidir is integrated. Please refer to the docs and help.

@jarun Thanks for pointing it out! Somehow missed it in the readme.

@jarun Hello, I have just started using nnn. I had some queries, but most imminent for my workflow is customizing the file-opener. I've not used desktop environment for long, and when I did I didn't know anything about xdg-open and mimeopen. And as long as I've used ranger and then vifm, I've had configuration file to configure programs to launch the file in. I know about ^o but I think I should not write the programs name every time I want to open a file.

So, could you point me to some websites to learn configuring xdg-open?

You don't need to configure. From your DE file manager, right click on a file and set open with.

But I don't use any DE file manager. I've installed ubuntu minimal version without any DE at all. Don't you think it's not a good idea to have to install a program just to configure file opener?

Don't you think it's not a good idea to have to install a program just to configure file opener?

On latest master, we have restored the support for NNN_OPENER yesterday. So you can specify your own opener like mimeopen.

@lawnowner I found a simple way to do it:

  • ^K to select the file
  • ^S to run a command
  • ln -s (ncp) (ncp).ln // assuming you have ncp exported
  • Enter

symlink file.ln should be created now.

@jarun Thanks. That's a good solution among other simple ones, such as a pure shell solution, a script solution, or having any other copier program than ncp 'exported' (assuming it is installed on the system). Although it is my preferred fm, I think that nnn should support link creation natively.

The problem is there may be too many cases (while file/dir creation are limited to the same parent dir):

  • link to a single file or multiple? (if mutiple we need selection)
  • create link to a file in the same dir? (if not, again we need to check selection)
  • if multiple, we need to check for every file if it's present
  • if present, overwrite or not?

So you see, to really provide a complete solution is not a trivial thing in this case. What do you suggest?

@jarun After making a selection of one or more files/directories and navigating to a destination directory, via the nnn interface, both linking (N/A) and copying/moving (P/V) involve resolving the same cases against duplicates at the destination. Since nnn can copy/move without re-implementing cp/mv utilities, maybe I could suggest treating the linking operation as pseudo-copying. The 'n' prompt could be a good place to interject link creation options, but of course a shortcut like P/V is another option.

involve resolving the same cases against duplicates at the destination

Yes, we use cp. mv, rm here which have their own guards. I didn't want to re-write the logic again.

Now, for multiple file selection, we do not call cp, mv, rm again and again. We call them once. But I don't think we can do that for ln. I think as this is tied to selection and the methodology remains the same, adding a new option is a natural choice. But it also needs a new option. :(

I was also thinking of using lower level APIs for ln to implement in the same workflow as new.

Maybe I am not just so sure yet, which workflow is better. Let me think a bit more.

More issues, for hardlinks do we ask for linkname each time of use .sln and .hln for shard and soft links? What do we do if the *ln file exists?

@lawnowner I think it's better to go the API way instead of calling binaries. Would it be possible for you to raise the PR?

Batch link creation is pushed at commit 8ff56d2c74b14f258a15134cbfb7c8a428ecbeef.

@jarun Thanks for the new feature! I think the project has got sensible design decisions, such as sticking to XDG standards, optionally via intermediaries like mimeopen to provide simplified interfaces, and maintaining a lean and keen binary. Hopefully, it remains so.

Latest master also supports links with same name.

Rolled at #202.

@gsakkis feedback for selected files will soon be in.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CantoroMC picture CantoroMC  路  4Comments

kuntau picture kuntau  路  3Comments

lenormf picture lenormf  路  6Comments

deadpyxel picture deadpyxel  路  5Comments

akimdi picture akimdi  路  5Comments