My build of nnn with minor changes
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

540 行
16 KiB

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