]> Sergey Matveev's repositories - nnn.git/blob - nnn.1
Prepare for release v4.6 Absinthe
[nnn.git] / nnn.1
1 .Dd Jul 26, 2022
2 .Dt NNN 1
3 .Os
4 .Sh NAME
5 .Nm nnn
6 .Nd The unorthodox terminal file manager.
7 .Sh SYNOPSIS
8 .Nm
9 .Op Ar -aAcCdDeEfgHJKnQrRSuUVxh
10 .Op Ar -b key
11 .Op Ar -F val
12 .Op Ar -l val
13 .Op Ar -p file
14 .Op Ar -P key
15 .Op Ar -s name
16 .Op Ar -t secs
17 .Op Ar -T key
18 .Op Ar PATH
19 .Sh DESCRIPTION
20 .Nm
21 .Pq Nnn's Not Noice
22 is a performance-optimized, feature-packed fork of noice
23 .Em http://git.2f30.org/noice/
24 with seamless desktop integration, simplified navigation,
25 .Em type-to-nav
26 mode with dir auto-enter, disk usage analyzer mode, bookmarks,
27 contexts, application launcher, familiar navigation shortcuts,
28 subshell spawning and much more. It remains a simple and
29 efficient file manager that stays out of your way.
30 .Pp
31 .Nm
32 opens the current working directory by default if
33 .Ar PATH
34 is not specified.
35 .Sh KEYBINDS
36 .Pp
37 Press
38 .Ql \&?
39 in
40 .Nm
41 to see the list of keybinds.
42 .Sh OPTIONS
43 .Pp
44 .Nm
45 supports the following options:
46 .Pp
47 .Fl a
48         auto-setup temporary NNN_FIFO (described in ENVIRONMENT section)
49 .Pp
50 .Fl A
51         disable directory auto-enter on unique filter match
52 .Pp
53 .Fl "b key"
54         specify bookmark key to open
55 .Pp
56 .Fl c
57         indicates that the opener is a cli-only opener (overrides -e)
58 .Pp
59 .Fl C
60         8-color scheme - color directories by context, disable file colors
61 .Pp
62 .Fl d
63         detail mode
64 .Pp
65 .Fl D
66         show directories in context color with \fBNNN_FCOLORS\fR set
67 .Pp
68 .Fl e
69         open text files in $VISUAL (else $EDITOR, fallback vi) [preferably CLI]
70 .Pp
71 .Fl E
72         use $EDITOR for internal undetached edits
73 .Pp
74 .Fl f
75         use readline history file
76 .Pp
77 .Fl "F val"
78         fifo notification mode
79         0: notify as previewer, 1: notify as explorer
80 .Pp
81 .Fl g
82         use regex filters instead of substring match
83 .Pp
84 .Fl H
85         show hidden files
86 .Pp
87 .Fl i
88         show current file information in info bar (may be slow)
89 .Pp
90 .Fl J
91         disable auto-advance on selection
92         (eg. selecting an entry will no longer move cursor to the next entry)
93 .Pp
94 .Fl K
95         test for keybind collision
96 .Pp
97 .Fl "l val"
98         number of lines to move per mouse wheel scroll
99 .Pp
100 .Fl n
101         start in type-to-nav mode
102 .Pp
103 .Fl o
104         open files only on Enter key
105 .Pp
106 .Fl "p file"
107         copy (or \fIpick\fR) selection to file, or stdout if file='-'
108 .Pp
109 .Fl "P key"
110         specify plugin key to run
111 .Pp
112 .Fl Q
113         disable confirmation on quit with multiple contexts active
114 .Pp
115 .Fl r
116         show cp, mv progress
117         (Linux-only, needs \fIadvcpmv\fR; '^T' shows the progress on BSD/macOS)
118 .Pp
119 .Fl R
120         disable rollover at edges (eg. pressing \fIdown\fR while on the last
121         entry will no longer move cursor to the first entry and vice\-versa)
122 .Pp
123 .Fl "s name"
124         load a session by name
125 .Pp
126 .Fl S
127         persistent session
128 .Pp
129 .Fl "t secs"
130         idle timeout in seconds to lock terminal
131 .Pp
132 .Fl "T key"
133         sort order
134         keys: 'a'u / 'd'u / 'e'xtension / 'r'everse / 's'ize / 't'ime / 'v'ersion
135         capitalize to reverse (except 'r')
136 .Pp
137 .Fl u
138         use selection if available, don't prompt to choose between selection and hovered entry
139 .Pp
140 .Fl U
141         show user and group names in status bar
142 .Pp
143 .Fl V
144         show version and exit
145 .Pp
146 .Fl x
147         show notifications on selection cp, mv, rm completion (requires \fI.ntfy\fR plugin)
148         copy path to system clipboard on selection (requires \fI.cbcp\fR plugin)
149         show xterm title (if non-picker mode)
150 .Pp
151 .Fl h
152         show program help and exit
153 .Sh CONFIGURATION
154 There is no configuration file. Associated files are at
155 .Pp
156 .Pa ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/
157 .Pp
158 Configuration is done using a few optional (set if you need) environment
159 variables. See ENVIRONMENT section.
160 .Pp
161 .Nm
162 uses \fIxdg-open\fR (on Linux), \fIopen(1)\fR (on macOS), \fIcygstart\fR on
163 (Cygwin) and \fIopen\fR on (Haiku) as the desktop opener. It's also possible
164 to specify a custom opener. See ENVIRONMENT section.
165 .Sh CONTEXTS
166 Open multiple locations with 4 contexts. The status is shown in the top left
167 corner:
168 .Pp
169 - the current context is in reverse video
170 .br
171 - other active contexts are underlined
172 .br
173 - rest are inactive
174 .Pp
175 A new context copies the state of the previous context. Each context can have
176 its own color. See ENVIRONMENT section.
177 .Sh SESSIONS
178 Sessions are a way to save and restore states of work. A session stores the
179 settings and contexts. Sessions can be loaded at runtime or with a program
180 option.
181 .Pp
182 - When a session is loaded at runtime, the last working state is saved
183 automatically to a dedicated "auto session" session file. Session option
184 \fIrestore\fR would restore the "auto session".
185 .br
186 - The persistent session option is global. If it is used, the last active session
187 will be updated with the final state at program quit.
188 .br
189 - The "auto session" is used in persistent session mode if no session is active.
190 .br
191 - Listing input stream and opening a bookmark by key have a higher priority to
192 session options (-s/-S).
193 .Pp
194 All the session files are located by session name in the directory
195 .Pp
196 \fB${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions\fR
197 .Pp
198 "@" is the "auto session" file.
199 .Sh FILTERS
200 Filters are strings (or regex patterns) to find matching entries in the current
201 directory instantly (\fIsearch-as-you-type\fR). Matches are case-insensitive by
202 default. The last filter in each context is persisted at runtime or in saved
203 sessions.
204 .br
205 When there's a unique match and it's a directory,
206 .Nm
207 auto enters the directory. Use the relevant program option to disable this.
208 .Pp
209 Special keys at filter prompt:
210 .Bd -literal
211 -------- + ---------------------------------------
212   Key    |                Function
213 -------- + ---------------------------------------
214  ^char   | Usual keybind functionality
215  Esc     | Exit filter prompt but skip dir refresh
216  Alt+Esc | Exit filter prompt and refresh dir
217 -------- + ---------------------------------------
218 .Ed
219 .Pp
220 Special keys at \fBempty filter prompt\fR:
221 .Bd -literal
222 ------ + ---------------------------------------
223   Key  |                Function
224 ------ + ---------------------------------------
225    ?   | Show help and config screen
226    /   | Toggle between string and regex
227    :   | Toggle case-sensitivity
228   ^L   | Clear filter (\fIif prompt is non-empty\fR)
229        | OR apply last filter
230   Bksp | Stay at filter prompt and refresh dir
231   Del  | Stay at filter prompt and refresh dir
232 ------ + ---------------------------------------
233 .Ed
234 .Pp
235 Common regex use cases:
236 .Pp
237 (1) To list all matches starting with the filter expression,
238     start the expression with a '^' (caret) symbol.
239 .br
240 (2) Type '\\.mkv' to list all MKV files.
241 .br
242 (3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
243 .br
244 (4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
245 .Pp
246 In the \fBtype-to-nav\fR mode directories are opened in filter
247 mode, allowing continuous navigation.
248 .Pp
249 Additional special keys at \fBempty filter prompt\fR
250 in \fBtype-to-nav\fR mode:
251 .Bd -literal
252 ------ + ------------------------
253   Key  |         Function
254 ------ + ------------------------
255    '   | Go to first non-dir file
256    +   | Toggle file selection
257    ,   | Mark CWD
258    -   | Go to last visited dir
259    .   | Show hidden files
260    ;   | Run a plugin by its key
261    =   | Launch a GUI application
262    >   | Export file list
263    @   | Visit start dir
264    ]   | Show command prompt
265    `   | Visit /
266    ~   | Go HOME
267 ------ + ------------------------
268 .Ed
269 .Sh SELECTION
270 .Nm
271 allows file selection across directories and contexts!
272 .Pp
273 There are 3 groups of keybinds to add files to selection:
274 .Pp
275 (1) hovered file selection toggle
276     - deselects if '+' is visible before the entry, else adds to selection
277 .br
278 (2) add a range of files to selection
279     - repeat the range key on the same entry twice to clear selection completely
280 .br
281 (3) add all files in the current directory to selection
282 .Pp
283 A selection can be edited, copied, moved, removed, archived or linked.
284 .Pp
285 Absolute paths of the selected files are copied to \fB.selection\fR file in
286 the config directory. The selection file is shared between multiple program
287 instances. Selection from multiple instances are not merged. The last instance
288 writing to the file overwrites earlier contents. If you have 2 instances of
289 .Nm
290 \fIopen\fR in 2 panes of a terminal multiplexer, you can select in one pane and
291 use the selection in the other pane. The selection gets cleared in the
292 .Nm
293 instance where the selection was made on mv/rm (but not on cp).
294 .Pp
295 .Nm
296 clears the selection after a successful operation with the selection. Plugins
297 are allowed to define the behaviour individually.
298 .Pp
299 To edit the selection use the _edit selection_ key. Editing doesn't end the
300 selection mode. You can add more files to the selection and edit the list
301 again. If no file is selected in the current session, this option attempts
302 to list the selection file.
303 .Sh FIND AND LIST
304 There are two ways to search and list:
305 .Pp
306 - feed a list of file paths as input
307 .br
308 - search using a plugin (e.g. \fIfinder\fR) and list the results
309 .Pp
310 File paths must be NUL-separated ('\\0'). Paths and can be relative to the
311 current directory or absolute. Invalid paths in the input are ignored. Input
312 limit is 65,536 paths or 256 MiB of data.
313 .Pp
314 To list the input stream, start
315 .Nm
316 by writing to its standard input. E.g., to list files in current
317 directory larger than
318 1M:
319 .Bd -literal
320     find -maxdepth 1 -size +1M -print0 | nnn
321 .Ed
322 .Pp
323 or redirect a list from a file:
324 .Bd -literal
325     nnn < files.txt
326 .Ed
327 .Pp
328 Handy bash/zsh shell function to list files by mime-type in current directory:
329 .Bd -literal
330     # to show video files, run: list video
331
332     list ()
333     {
334         find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s\0", $1}' | nnn
335     }
336 .Ed
337 .Pp
338 A temporary directory will be created containing symlinks to the given
339 paths. Any action performed on these symlinks will be performed only on their
340 targets, after which they might become invalid.
341 .Pp
342 Right arrow or 'l' on a symlink in the listing dir takes to the target
343 file. Press '-' to return to the listing dir. Press 'Enter' to open the symlink.
344 .Pp
345 Listing input stream can be scripted. It can be extended to pick (option -p)
346 selected entries from the listed results.
347 .Sh BOOKMARKS
348 There are 2 ways (can be used together) to manage bookmarks.
349 .Pp
350 (1) Bookmark keys: See \fINNN_BMS\fR under \fIENVIORNMENT\fR section on how to set
351     bookmark keys.
352
353     The select bookmark key \fIb\fR lists all the bookmark keys set in \fINNN_BMS\fR
354     in the bookmarks prompt.
355 .Pp
356 (2) Symlinked bookmarks: A symlinked bookmark to the current directory can
357     be created with the \fIB\fR key (or manually under ~/.config/nnn/bookmarks).
358
359     Pressing 'Enter' at the bookmarks prompt takes to this directory.
360     If \fINNN_BMS\fR is not set, the select bookmark key directly opens it.
361 .Pp
362 On entering a bookmark, the directory where the select bookmark key was
363 pressed is set as the previous directory. Press '-' to return to it.
364 .Pp
365 .Sh UNITS
366 The minimum file size unit is byte (B). The rest are K, M, G, T, P, E, Z, Y
367 (powers of 1024), same as the default units in \fIls\fR.
368 .Sh ENVIRONMENT
369 The SHELL, VISUAL (else EDITOR) and PAGER environment variables are
370 used. A single combination of arguments is supported for SHELL and PAGER.
371 .Pp
372 \fBNNN_OPTS:\fR binary options to
373 .Nm
374 .Bd -literal
375     export NNN_OPTS="cEnrx"
376 .Ed
377 .Pp
378 \fBNNN_OPENER:\fR specify a custom file opener.
379 .Bd -literal
380     export NNN_OPENER=nuke
381
382     NOTE: 'nuke' is a file opener available in the plugin repository.
383 .Ed
384 .Pp
385 \fBNNN_BMS:\fR bookmark string as \fIkey_char:location\fR pairs
386 separated by \fI;\fR:
387 .Bd -literal
388     export NNN_BMS="d:$HOME/Docs;u:/home/user/Cam Uploads;D:$HOME/Downloads/"
389 .Ed
390 .Pp
391 These bookmarks are listed in the help and config screen (key ?).
392 .Pp
393 \fBNNN_PLUG:\fR directly executable plugins as \fIkey_char:plugin\fR pairs
394 separated by \fI;\fR:
395 .Bd -literal
396     export NNN_PLUG='f:finder;o:fzopen;p:mocplay;d:diffs;t:nmount;v:imgview'
397
398     NOTES:
399     1. To run a plugin directly, press \fI;\fR followed by the key.
400     2. Alternatively, combine with \fIAlt\fR (i.e. \fIAlt+key\fR).
401     3. To skip directory refresh after running a plugin, prefix with \fB-\fR.
402
403     export NNN_PLUG='p:-plugin'
404 .Ed
405 .Pp
406     To assign keys to arbitrary non-background cli commands and invoke like
407     plugins, add \fI!\fR before the command.
408 .Bd -literal
409     export NNN_PLUG='x:!chmod +x $nnn;g:!git log;s:!smplayer $nnn'
410
411     To pick and run an unassigned plugin, press \fBEnter\fR at the plugin prompt.
412     To run a plugin at startup, use the option `-P` followed by the plugin key.
413
414     NOTES:
415     1. Use single quotes for $NNN_PLUG so $nnn is not interpreted
416     2. $nnn must be the last argument (if used) to run a \fIcommand as plugin\fR
417     3. (Again) add \fB!\fR before the command
418     4. To disable directory refresh after running a \fIcommand as plugin\fR,
419        prefix with \fB-!\fR
420     5. To skip user confirmation after command execution, suffix with \fB*\fR
421        Note: Do not use \fB*\fR with programs those run and exit e.g. cat
422
423         export NNN_PLUG='y:-!sync*'
424
425     6. To run a \fIGUI app as plugin\fR, add a \fB&\fR after \fB!\fR
426        Note: \fI$nnn\fR must be the last argument in this case.
427
428         export NNN_PLUG='m:-!&mousepad $nnn'
429
430     7. To show the output of run-and-exit commands which do not need user input,
431        add \fB|\fR (pipe) after \fB!\fR
432        Note: This option is incompatible with \fB&\fR (terminal output is masked
433        for GUI programs) and ignores \fB*\fR (output is already paged for user)
434
435         export NNN_PLUG='m:-!|mediainfo $nnn;t:-!|tree -ps;l:-!|ls -lah --group-directories-first'
436
437     EXAMPLES:
438     ------------------------------------ + -------------------------------------------------
439                 Key:Command              |                   Description
440     ------------------------------------ + -------------------------------------------------
441     c:!convert $nnn png:- | xclip -sel \ | Copy image to clipboard
442        clipboard -t image/png*           |
443     e:-!sudo -E vim $nnn*                | Edit file as root in vim
444     g:-!git diff                         | Show git diff
445     h:-!hx $nnn*                         | Open hovered file in hx hex editor
446     k:-!fuser -kiv $nnn*                 | Interactively kill process(es) using hovered file
447     l:-!git log                          | Show git log
448     n:-!vi /home/user/Dropbox/dir/note*  | Take quick notes in a synced file/dir of notes
449     p:-!less -iR $nnn*                   | Page through hovered file in less
450     s:-!&smplayer -minigui $nnn          | Play hovered media file, even unfinished download
451     x:!chmod +x $nnn                     | Make the hovered file executable
452     y:-!sync*                            | Flush cached writes
453     ------------------------------------ + -------------------------------------------------
454
455     Online docs: https://github.com/jarun/nnn/tree/master/plugins
456 .Ed
457 .Pp
458 \fBNNN_ORDER:\fR directory-specific sort key.
459 .Bd -literal
460     export NNN_ORDER='t:/home/user/Downloads;S:/tmp'
461
462     NOTE: Sort keys can be a/d/e/r/s/t/v (see program option -T).
463           Capitalize to reverse (except 'r').
464           Path must be absolute.
465
466           Timestamps for entries modified/created within 5 minutes are shown in reverse.
467 .Ed
468 .Pp
469 \fBNNN_COLORS:\fR string of color numbers for each context, e.g.:
470 .Bd -literal
471     # 8 color numbers:
472     # 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
473     export NNN_COLORS='1234'
474
475     # xterm 256 color numbers (converted to hex, 2 symbols per context):
476     # see https://user-images.githubusercontent.com/1482942/93023823-46a6ba80-f5e1-11ea-9ea3-6a3c757704f4.png
477     export NNN_COLORS='#0a1b2c3d'
478
479     # both (256 followed by 8 as fallback, separated by ';')
480     export NNN_COLORS='#0a1b2c3d;1234'
481
482     NOTE: If only 256 colors are specified and the terminal doesn't support, default is used.
483 .Ed
484 .Pp
485 \fBNNN_FCOLORS:\fR specify file-type specific colors:
486 .Bd -literal
487     export NNN_FCOLORS='c1e2272e006033f7c6d6abc4'
488
489     Specify file-specific colors in xterm 256 color hex numbers (2 symbols per color).
490     Order is strict, use 00 to omit/use default terminal color. Defaults:
491
492     ------------------------- + --- + -------------
493               Order           | Hex |    Color
494     ------------------------- + --- + -------------
495     Block device              | c1  | DarkSeaGreen1
496     Char device               | e2  | Yellow1
497     Directory                 | 27  | DeepSkyBlue1
498     Executable                | 2e  | Green1
499     Regular                   | 00  | Normal
500     Hard link                 | 60  | Plum4
501     Symbolic link             | 33  | Cyan1
502     Missing OR file details   | f7  | Grey62
503     Orphaned symbolic link    | c6  | DeepPink1
504     FIFO                      | d6  | Orange1
505     Socket                    | ab  | MediumOrchid1
506     Unknown OR 0B regular/exe | c4  | Red1
507     ------------------------- + --- + -------------
508
509     If the terminal supports xterm 256 colors or more, file-specific colors will be rendered.
510     To force the 8-color scheme use option -C.
511     If xterm 256 colors aren't supported, 8-color scheme will be used.
512 .Ed
513 .Pp
514 \fBNNN_ARCHIVE:\fR archive extensions to be handled silently (default: bzip2, (g)zip, tar).
515 .Bd -literal
516     export NNN_ARCHIVE="\\\\.(7z|bz2|gz|tar|tgz|zip)$"
517
518     NOTE: Non-default formats may require a third-party utility.
519 .Ed
520 .Pp
521 \fBNNN_SSHFS:\fR specify custom sshfs command with options:
522 .Bd -literal
523     export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
524
525     NOTE: The options must be comma-separated without any space between them.
526 .Ed
527 .Pp
528 \fBNNN_RCLONE:\fR pass additional options to rclone command:
529 .Bd -literal
530     export NNN_RCLONE='rclone mount --read-only --no-checksum'
531
532     NOTE: The options must be preceded by "rclone" and max 5 flags are supported.
533 .Ed
534 .Pp
535 \fBNNN_TRASH:\fR trash (instead of \fIrm -rf\fR) files to desktop Trash.
536 .Bd -literal
537     export NNN_TRASH=n
538     # n=1: trash-cli, n=2: gio trash
539 .Ed
540 .Pp
541 \fBNNN_SEL:\fR absolute path to custom selection file.
542 .Pp
543 \fBNNN_FIFO:\fR path of a named pipe to write the hovered file path:
544 .Bd -literal
545     export NNN_FIFO='/tmp/nnn.fifo'
546
547     NOTES:
548     1. Overridden by a temporary path with -a option.
549     2. If the FIFO file doesn't exist it will be created,
550        but not removed (unless it is generated by -a option).
551
552     Online docs: https://github.com/jarun/nnn/wiki/Live-previews
553 .Ed
554 .Pp
555 \fBNNN_LOCKER:\fR terminal locker program.
556 .Bd -literal
557     export NNN_LOCKER='bmon -p wlp1s0'
558     export NNN_LOCKER='cmatrix'
559 .Ed
560 .Pp
561 \fBNNN_TMPFILE:\fR \fIalways\fR cd on quit and write the command in the file specified.
562 .Bd -literal
563     export NNN_TMPFILE='/tmp/.lastd'
564 .Ed
565 .Pp
566 \fBNNN_HELP:\fR run a program and show the output on top of the program help page.
567 .Bd -literal
568     export NNN_HELP='fortune'
569 .Ed
570 .Pp
571 \fBNNN_MCLICK:\fR key emulated by a middle mouse click.
572 .Bd -literal
573     export NNN_MCLICK='^R'
574
575     NOTE: Only the first character is considered if not a \fICtrl+key\fR combo.
576 .Ed
577 .Pp
578 \fBnnn:\fR this is a special variable.
579 .Bd -literal
580     Set to the hovered file name before starting the command prompt or spawning a shell.
581 .Ed
582 .Pp
583 \fBNO_COLOR:\fR disable ANSI color output (overridden by \fBNNN_COLORS\fR).
584 .Sh AUTHORS
585 .An Arun Prakash Jana Aq Mt engineerarun@gmail.com ,
586 .An Lazaros Koromilas Aq Mt lostd@2f30.org ,
587 .An Dimitris Papastamos Aq Mt sin@2f30.org .
588 .Sh HOME
589 .Em https://github.com/jarun/nnn