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

547 行
17 KiB

  1. .Dd Nov 17, 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. show user and group names in status bar
  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. Listing input stream has a higher priority to session options (-s/-S). Sessions
  197. can be loaded explicitly at runtime. Session option \fIrestore\fR would restore
  198. the persistent session at runtime.
  199. .Pp
  200. All the session files are located by session name in the directory
  201. .Pp
  202. \fB${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions\fR
  203. .Pp
  204. "@" is the "last session" file.
  205. .Sh FILTERS
  206. Filters are strings (or regex patterns) to find matching entries in the current
  207. directory instantly (\fIsearch-as-you-type\fR). Matches are case-insensitive by
  208. default. The last filter in each context is persisted at runtime or in saved
  209. sessions.
  210. .Pp
  211. Special keys at filter prompt:
  212. .Bd -literal
  213. -------- + ---------------------------------------
  214. Key | Function
  215. -------- + ---------------------------------------
  216. ^char | Usual keybind functionality
  217. Esc | Exit filter prompt but skip dir refresh
  218. Alt+Esc | Exit filter prompt and refresh dir
  219. -------- + ---------------------------------------
  220. .Ed
  221. .Pp
  222. Special keys at \fBempty filter prompt\fR:
  223. .Bd -literal
  224. ------ + ---------------------------------------
  225. Key | Function
  226. ------ + ---------------------------------------
  227. ? | Show help and config screen
  228. / | Toggle between string and regex
  229. : | Toggle case-sensitivity
  230. ^L | Clear filter (\fIif prompt is non-empty\fR)
  231. | OR apply last filter
  232. ------ + ---------------------------------------
  233. .Ed
  234. .Pp
  235. Additional special keys at \fBempty filter prompt\fR
  236. in \fBtype-to-nav\fR mode:
  237. .Bd -literal
  238. ------ + ------------------------
  239. Key | Function
  240. ------ + ------------------------
  241. ' | Go to first non-dir file
  242. + | Toggle auto-advance
  243. , | Mark CWD
  244. - | Go to last visited dir
  245. . | Show hidden files
  246. ; | Run a plugin by its key
  247. = | Launch a GUI application
  248. > | Export file list
  249. @ | Visit start dir
  250. ] | Show command prompt
  251. ` | Visit /
  252. ~ | Go HOME
  253. ------ + ------------------------
  254. .Ed
  255. .Pp
  256. Common regex use cases:
  257. .Pp
  258. (1) To list all matches starting with the filter expression,
  259. start the expression with a '^' (caret) symbol.
  260. .br
  261. (2) Type '\\.mkv' to list all MKV files.
  262. .br
  263. (3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
  264. .br
  265. (4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
  266. .Pp
  267. In the \fItype-to-nav\fR mode directories are opened in filter
  268. mode, allowing continuous navigation.
  269. .br
  270. When there's a unique match and it's a directory,
  271. .Nm
  272. auto selects the directory and enters it in this mode. Use the relevant
  273. program option to disable this behaviour.
  274. .Sh SELECTION
  275. .Nm
  276. allows file selection across directories and contexts!
  277. .Pp
  278. There are 3 groups of keybinds to add files to selection:
  279. .Pp
  280. (1) hovered file selection toggle
  281. - deselects if '+' is visible before the entry, else adds to selection
  282. .br
  283. (2) add a range of files to selection
  284. - repeat the range key on the same entry twice to clear selection completely
  285. .br
  286. (3) add all files in the current directory to selection
  287. .Pp
  288. A selection can be edited, copied, moved, removed, archived or linked.
  289. .Pp
  290. Absolute paths of the selected files are copied to \fB.selection\fR file in
  291. the config directory. The selection file is shared between multiple program
  292. instances. The most recent instance writing to the file overwrites the entries
  293. from earlier writes. If you have 2 instances if
  294. .Nm
  295. \fIopen\fR in 2 panes of a terminal multiplexer, you can select in one pane and
  296. use the selection (e.g. to copy or move) in the other pane (if the instance
  297. doesn't have any local selection already).
  298. .Pp
  299. .Nm
  300. clears the selection after file removal, batch-rename and link creation with
  301. selection. However, it is retained after archive creation with selection as
  302. the user may want to delete the archived files next.
  303. .Pp
  304. To edit the selection use the _edit selection_ key. Use this key to remove a
  305. file from selection after you navigate away from its directory. Editing doesn't
  306. end the selection mode. You can add more files to the selection and edit the
  307. list again. If no file is selected in the current session, this option attempts
  308. to list the selection file.
  309. .Sh FIND AND LIST
  310. There are two ways to search and list:
  311. .Pp
  312. - feed a list of file paths as input
  313. .br
  314. - search using a plugin (e.g. \fIfinder\fR) and list the results
  315. .Pp
  316. File paths must be NUL-separated ('\\0'). Paths and can be relative to the
  317. current directory or absolute. Invalid paths in the input are ignored. Input
  318. limit is 65,536 paths or 256 MiB of data.
  319. .Pp
  320. To list the input stream, start
  321. .Nm
  322. by writing to its standard input. E.g., to list files in current
  323. directory larger than
  324. 1M:
  325. .Bd -literal
  326. find -maxdepth 1 -size +1M -print0 | nnn
  327. .Ed
  328. .Pp
  329. or redirect a list from a file:
  330. .Bd -literal
  331. nnn < files.txt
  332. .Ed
  333. .Pp
  334. Handy bash/zsh shell function to list files by mime-type in current directory:
  335. .Bd -literal
  336. # to show video files, run: list video
  337. list ()
  338. {
  339. find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s\0", $1}' | nnn
  340. }
  341. .Ed
  342. .Pp
  343. A temporary directory will be created containing symlinks to the given
  344. paths. Any action performed on these symlinks will be performed only on their
  345. targets, after which they might become invalid.
  346. .Pp
  347. Right arrow or 'l' on a symlink in the listing dir takes to the target
  348. file. Press '-' to return to the listing dir. Press 'Enter' to open the symlink.
  349. .Pp
  350. Listing input stream can be scripted. It can be extended to pick (option -p)
  351. selected entries from the listed results.
  352. .Sh UNITS
  353. The minimum file size unit is byte (B). The rest are K, M, G, T, P, E, Z, Y
  354. (powers of 1024), same as the default units in \fIls\fR.
  355. .Sh ENVIRONMENT
  356. The SHELL, VISUAL (else EDITOR) and PAGER environment variables are
  357. used. A single combination of arguments is supported for SHELL and PAGER.
  358. .Pp
  359. \fBNNN_OPTS:\fR binary options to
  360. .Nm
  361. .Bd -literal
  362. export NNN_OPTS="cEnrx"
  363. .Ed
  364. .Pp
  365. \fBNNN_OPENER:\fR specify a custom file opener.
  366. .Bd -literal
  367. export NNN_OPENER=nuke
  368. NOTE: 'nuke' is a file opener available in the plugin repository.
  369. .Ed
  370. .Pp
  371. \fBNNN_BMS:\fR bookmark string as \fIkey_char:location\fR pairs
  372. separated by \fI;\fR:
  373. .Bd -literal
  374. export NNN_BMS='d:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/'
  375. .Ed
  376. .Pp
  377. \fBNNN_PLUG:\fR directly executable plugins as \fIkey_char:plugin\fR pairs
  378. separated by \fI;\fR:
  379. .Bd -literal
  380. export NNN_PLUG='f:finder;o:fzopen;p:mocplay;d:diffs;t:nmount;v:imgview'
  381. NOTES:
  382. 1. To run a plugin directly, press \fI;\fR followed by the key.
  383. 2. Alternatively, combine with \fIAlt\fR (i.e. \fIAlt+key\fR).
  384. 3. To skip directory refresh after running a plugin, prefix with \fB-\fR.
  385. export NNN_PLUG='m:-mediainf'
  386. .Ed
  387. .Pp
  388. To assign keys to arbitrary non-background non-shell-interpreted cli
  389. commands and invoke like plugins, add \fI_\fR (underscore) before the
  390. command.
  391. .Bd -literal
  392. export NNN_PLUG='x:_chmod +x $nnn;g:_git log;s:_smplayer $nnn'
  393. To pick and run an unassigned plugin, press \fBEnter\fR at the plugin prompt.
  394. To run a plugin at startup, use the option `-P` followed by the plugin key.
  395. NOTES:
  396. 1. Use single quotes for $NNN_PLUG so $nnn is not interpreted
  397. 2. $nnn should be the last argument (IF used)
  398. 3. (Again) add \fB_\fR before the command
  399. 4. To disable directory refresh after running a \fIcommand as plugin\fR,
  400. prefix with \fB-_\fR
  401. 5. To skip user confirmation after command execution, suffix with \fB*\fR
  402. Note: Do not use \fB*\fR with programs those run and exit e.g. cat
  403. export NNN_PLUG='y:-_sync*'
  404. 6. To run a \fIGUI app as plugin\fR, add a \fB|\fR after \fB_\fR
  405. export NNN_PLUG='m:-_|mousepad $nnn'
  406. EXAMPLES:
  407. ----------------------------------- + -------------------------------------------------
  408. Key:Command | Description
  409. ----------------------------------- + -------------------------------------------------
  410. g:-_git diff | Show git diff
  411. k:-_fuser -kiv $nnn* | Interactively kill process(es) using hovered file
  412. l:-_git log | Show git log
  413. n:-_vi /home/user/Dropbox/dir/note* | Take quick notes in a synced file/dir of notes
  414. p:-_less -iR $nnn* | Page through hovered file in less
  415. s:-_|smplayer -minigui $nnn | Play hovered media file, even unfinished download
  416. x:_chmod +x $nnn | Make the hovered file executable
  417. y:-_sync* | Flush cached writes
  418. ----------------------------------- + -------------------------------------------------
  419. .Ed
  420. .Pp
  421. \fBNNN_COLORS:\fR string of color numbers for each context, e.g.:
  422. .Bd -literal
  423. # 8 color numbers:
  424. # 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
  425. export NNN_COLORS='1234'
  426. # xterm 256 color numbers (converted to hex, 2 symbols per context):
  427. # see https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
  428. export NNN_COLORS='#0a1b2c3d'
  429. # both (256 followed by 8 as fallback, separated by ';')
  430. export NNN_COLORS='#0a1b2c3d;1234'
  431. NOTE: If only 256 colors are specified and the terminal doesn't support, default is used.
  432. .Ed
  433. .Pp
  434. \fBNNN_FCOLORS:\fR specify file-type specific colors:
  435. .Bd -literal
  436. export NNN_FCOLORS='c1e2272e006033f7c6d6abc4'
  437. Specify file-specific colors with decimal xterm 256 color numbers converted
  438. to 2 hex symbols per color.
  439. Order is strict, use 00 to omit/use default terminal color. Defaults:
  440. ------------------------- + --- + -------------
  441. Order | Hex | Color
  442. ------------------------- + --- + -------------
  443. Block device | c1 | DarkSeaGreen1
  444. Char device | e2 | Yellow1
  445. Directory | 27 | DeepSkyBlue1
  446. Executable | 2e | Green1
  447. Regular | 00 | Normal
  448. Hard link | 60 | Plum4
  449. Symbolic link | 33 | Cyan1
  450. Missing OR file details | f7 | Grey62
  451. Orphaned symbolic link | c6 | DeepPink1
  452. FIFO | d6 | Orange1
  453. Socket | ab | MediumOrchid1
  454. Unknown OR 0B regular/exe | c4 | Red1
  455. ------------------------- + --- + -------------
  456. If the terminal supports xterm 256 colors or more, file-specific colors will be rendered.
  457. To force the earlier colorscheme use option -C.
  458. If xterm 256 colors aren't supported, earlier colorscheme will be used.
  459. .Ed
  460. .Pp
  461. \fBNNN_ARCHIVE:\fR archive extensions to be handled silently (default: bzip2, (g)zip, tar).
  462. .Bd -literal
  463. export NNN_ARCHIVE="\\\\.(7z|bz2|gz|tar|tgz|zip)$"
  464. NOTE: Non-default formats may require a third-party utility.
  465. .Ed
  466. .Pp
  467. \fBNNN_SSHFS:\fR specify custom sshfs command with options:
  468. .Bd -literal
  469. export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
  470. NOTE: The options must be comma-separated without any space between them.
  471. .Ed
  472. .Pp
  473. \fBNNN_RCLONE:\fR pass additional options to rclone command:
  474. .Bd -literal
  475. export NNN_RCLONE='rclone mount --read-only --no-checksum'
  476. NOTE: The options must be preceded by "rclone" and max 5 flags are supported.
  477. .Ed
  478. .Pp
  479. \fBNNN_TRASH:\fR trash (instead of \fIrm -rf\fR) files to desktop Trash.
  480. .Bd -literal
  481. export NNN_TRASH=n
  482. # n=1: trash-cli, n=2: gio trash
  483. .Ed
  484. .Pp
  485. \fBNNN_SEL:\fR absolute path to custom selection file.
  486. .Pp
  487. \fBNNN_FIFO:\fR path of a named pipe to write the hovered file path:
  488. .Bd -literal
  489. export NNN_FIFO='/tmp/nnn.fifo'
  490. NOTES:
  491. 1. Overridden by a temporary path with -a option.
  492. 2. If the FIFO file doesn't exist it will be created,
  493. but not removed (unless it is generated by -a option).
  494. .Ed
  495. .Pp
  496. .Em https://github.com/jarun/nnn/wiki/Live-previews
  497. .Pp
  498. \fBNNN_LOCKER:\fR terminal locker program.
  499. .Bd -literal
  500. export NNN_LOCKER='bmon -p wlp1s0'
  501. export NNN_LOCKER='cmatrix'
  502. .Ed
  503. .Pp
  504. \fBNNN_MCLICK:\fR key emulated by a middle mouse click.
  505. .Bd -literal
  506. export NNN_MCLICK='^R'
  507. NOTE: Only the first character is considered if not a \fICtrl+key\fR combo.
  508. .Ed
  509. .Pp
  510. \fBnnn:\fR this is a special variable.
  511. .Bd -literal
  512. Set to the hovered file name before starting the command prompt or spawning a shell.
  513. .Ed
  514. .Pp
  515. \fBNO_COLOR:\fR disable ANSI color output (overridden by \fBNNN_COLORS\fR).
  516. .Sh KNOWN ISSUES
  517. .Nm
  518. may not handle keypresses correctly when used with tmux (see issue #104 for
  519. more details). Set \fBTERM=xterm-256color\fR to address it.
  520. .Sh AUTHORS
  521. .An Arun Prakash Jana Aq Mt engineerarun@gmail.com ,
  522. .An Lazaros Koromilas Aq Mt lostd@2f30.org ,
  523. .An Dimitris Papastamos Aq Mt sin@2f30.org .
  524. .Sh HOME
  525. .Em https://github.com/jarun/nnn