My build of nnn with minor changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

534 lines
16 KiB

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