My build of nnn with minor changes
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

544 строки
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 -U
  37. .Op Ar -V
  38. .Op Ar -w
  39. .Op Ar -x
  40. .Op Ar -h
  41. .Op Ar PATH
  42. .Sh DESCRIPTION
  43. .Nm
  44. (Nnn's Not Noice) is a performance-optimized, feature-packed fork of
  45. noice (http://git.2f30.org/noice/) with seamless desktop
  46. integration, simplified navigation, \fItype-to-nav\fR mode with
  47. auto select, disk usage analyzer mode, bookmarks, contexts, application
  48. launcher, familiar navigation shortcuts, subshell spawning and much
  49. more. It remains a simple and efficient file manager that stays out of your way.
  50. .Pp
  51. .Nm
  52. opens the current working directory by default if
  53. .Ar PATH
  54. is not specified.
  55. .Sh KEYBINDS
  56. .Pp
  57. Press \fB?\fR in
  58. .Nm
  59. to see the list of keybinds.
  60. .Sh OPTIONS
  61. .Pp
  62. .Nm
  63. supports the following options:
  64. .Pp
  65. .Fl a
  66. auto-setup temporary NNN_FIFO (described in ENVIRONMENT section)
  67. .Pp
  68. .Fl A
  69. disable directory auto-select in type-to-nav mode
  70. .Pp
  71. .Fl "b key"
  72. specify bookmark key to open
  73. .Pp
  74. .Fl c
  75. indicates that the opener is a cli-only opener (overrides -e)
  76. .Pp
  77. .Fl C
  78. earlier colorscheme - color directories by context, disable file colors
  79. .Pp
  80. .Fl d
  81. detail mode
  82. .Pp
  83. .Fl D
  84. show directories in context color with \fBNNN_FCOLORS\fR set
  85. .Pp
  86. .Fl e
  87. open text files in $VISUAL (else $EDITOR, fallback vi) [preferably CLI]
  88. .Pp
  89. .Fl E
  90. use $EDITOR for internal undetached edits
  91. .Pp
  92. .Fl f
  93. use readline history file
  94. .Pp
  95. .Fl F
  96. show fortune in help and settings screen
  97. .Pp
  98. .Fl g
  99. use regex filters instead of substring match
  100. .Pp
  101. .Fl H
  102. show hidden files
  103. .Pp
  104. .Fl J
  105. disable auto-proceed on select
  106. .Pp
  107. .Fl K
  108. test for keybind collision
  109. .Pp
  110. .Fl "l val"
  111. number of lines to move per mouse wheel scroll
  112. .Pp
  113. .Fl n
  114. start in type-to-nav mode
  115. .Pp
  116. .Fl o
  117. open files only on Enter key
  118. .Pp
  119. .Fl "p file"
  120. copy (or \fIpick\fR) selection to file, or stdout if file='-'
  121. .Pp
  122. .Fl "P key"
  123. specify plugin key to run
  124. .Pp
  125. .Fl Q
  126. disable confirmation on quit with multiple contexts active
  127. .Pp
  128. .Fl r
  129. show cp, mv progress
  130. (Linux-only, needs advcpmv; '^T' shows the progress on BSD/macOS)
  131. .Pp
  132. .Fl R
  133. disable rollover at edges
  134. .Pp
  135. .Fl "s name"
  136. load a session by name
  137. .Pp
  138. .Fl S
  139. persistent session
  140. .Pp
  141. .Fl "t secs"
  142. idle timeout in seconds to lock terminal
  143. .Pp
  144. .Fl "T key"
  145. sort order
  146. keys: 'a'u / 'd'u / 'e'xtension / 'r'everse / 's'ize / 't'ime / 'v'ersion
  147. .Pp
  148. .Fl u
  149. use selection if available, don't prompt to choose between selection and hovered entry
  150. .Pp
  151. .Fl U
  152. show user and group names in status bar
  153. .Pp
  154. .Fl V
  155. show version and exit
  156. .Pp
  157. .Fl w
  158. place hardware cursor on hovered entry
  159. .Pp
  160. .Fl x
  161. show notis on selection cp, mv, rm completion
  162. copy path to system clipboard on select
  163. .Pp
  164. .Fl h
  165. show program help and exit
  166. .Sh CONFIGURATION
  167. There is no configuration file. Associated files are at
  168. .Pp
  169. \fB${XDG_CONFIG_HOME:-$HOME/.config}/nnn/\fR
  170. .Pp
  171. Configuration is done using a few optional (set if you need) environment
  172. variables. See ENVIRONMENT section.
  173. .Pp
  174. .Nm
  175. uses \fIxdg-open\fR (on Linux), \fIopen(1)\fR (on macOS), \fIcygstart\fR on
  176. (Cygwin) and \fIopen\fR on (Haiku) as the desktop opener. It's also possible
  177. to specify a custom opener. See ENVIRONMENT section.
  178. .Sh CONTEXTS
  179. Open multiple locations with 4 contexts. The status is shown in the top left
  180. corner:
  181. .Pp
  182. - the current context is in reverse video
  183. .br
  184. - other active contexts are underlined
  185. .br
  186. - rest are inactive
  187. .Pp
  188. A new context copies the state of the previous context. Each context can have
  189. its own color. See ENVIRONMENT section.
  190. .Sh SESSIONS
  191. Sessions are a way to save and restore states of work. A session stores the
  192. settings and contexts.
  193. .Pp
  194. Sessions can be loaded dynamically at runtime or with a program option.
  195. .Pp
  196. When a session is loaded dynamically, the last working session is saved
  197. automatically to a dedicated -- "last session" -- session file. The "last
  198. session" is also used in persistent session mode.
  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 file.
  348. Press '-' to return to the listing dir. Press 'Enter' to open the symlink.
  349. .Sh UNITS
  350. The minimum file size unit is byte (B). The rest are K, M, G, T, P, E, Z, Y
  351. (powers of 1024), same as the default units in \fIls\fR.
  352. .Sh ENVIRONMENT
  353. The SHELL, VISUAL (else EDITOR) and PAGER environment variables are
  354. used. A single combination of arguments is supported for SHELL and PAGER.
  355. .Pp
  356. \fBNNN_OPTS:\fR binary options to
  357. .Nm
  358. .Bd -literal
  359. export NNN_OPTS="cEnrx"
  360. .Ed
  361. .Pp
  362. \fBNNN_OPENER:\fR specify a custom file opener.
  363. .Bd -literal
  364. export NNN_OPENER=nuke
  365. NOTE: 'nuke' is a file opener available in the plugin repository.
  366. .Ed
  367. .Pp
  368. \fBNNN_BMS:\fR bookmark string as \fIkey_char:location\fR pairs
  369. separated by \fI;\fR:
  370. .Bd -literal
  371. export NNN_BMS='d:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/'
  372. .Ed
  373. .Pp
  374. \fBNNN_PLUG:\fR directly executable plugins as \fIkey_char:plugin\fR pairs
  375. separated by \fI;\fR:
  376. .Bd -literal
  377. export NNN_PLUG='f:finder;o:fzopen;p:mocplay;d:diffs;t:nmount;v:imgview'
  378. NOTES:
  379. 1. To run a plugin directly, press \fI;\fR followed by the key.
  380. 2. Alternatively, combine with \fIAlt\fR (i.e. \fIAlt+key\fR).
  381. 3. To skip directory refresh after running a plugin, prefix with \fB-\fR.
  382. export NNN_PLUG='m:-mediainf'
  383. .Ed
  384. .Pp
  385. To assign keys to arbitrary non-background non-shell-interpreted cli
  386. commands and invoke like plugins, add \fI_\fR (underscore) before the
  387. command.
  388. .Bd -literal
  389. export NNN_PLUG='x:_chmod +x $nnn;g:_git log;s:_smplayer $nnn'
  390. To pick and run an unassigned plugin, press \fBEnter\fR at the plugin prompt.
  391. To run a plugin at startup, use the option `-P` followed by the plugin key.
  392. NOTES:
  393. 1. Use single quotes for $NNN_PLUG so $nnn is not interpreted
  394. 2. $nnn should be the last argument (IF used)
  395. 3. (Again) add \fB_\fR before the command
  396. 4. To disable directory refresh after running a \fIcommand as plugin\fR,
  397. prefix with \fB-_\fR
  398. 5. To skip user confirmation after command execution, suffix with \fB*\fR
  399. Note: Do not use \fB*\fR with programs those run and exit e.g. cat
  400. export NNN_PLUG='y:-_sync*'
  401. 6. To run a \fIGUI app as plugin\fR, add a \fB|\fR after \fB_\fR
  402. export NNN_PLUG='m:-_|mousepad $nnn'
  403. EXAMPLES:
  404. ----------------------------------- + -------------------------------------------------
  405. Key:Command | Description
  406. ----------------------------------- + -------------------------------------------------
  407. g:-_git diff | Show git diff
  408. k:-_fuser -kiv $nnn* | Interactively kill process(es) using hovered file
  409. l:-_git log | Show git log
  410. n:-_vi /home/user/Dropbox/dir/note* | Take quick notes in a synced file/dir of notes
  411. p:-_less -iR $nnn* | Page through hovered file in less
  412. s:-_|smplayer -minigui $nnn | Play hovered media file, even unfinished download
  413. x:_chmod +x $nnn | Make the hovered file executable
  414. y:-_sync* | Flush cached writes
  415. ----------------------------------- + -------------------------------------------------
  416. .Ed
  417. .Pp
  418. \fBNNN_COLORS:\fR string of color numbers for each context, e.g.:
  419. .Bd -literal
  420. # 8 color numbers:
  421. # 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
  422. export NNN_COLORS='1234'
  423. # xterm 256 color numbers (converted to hex, 2 symbols per context):
  424. # see https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
  425. export NNN_COLORS='#0a1b2c3d'
  426. # both (256 followed by 8 as fallback, separated by ';')
  427. export NNN_COLORS='#0a1b2c3d;1234'
  428. NOTE: If only 256 colors are specified and the terminal doesn't support, default is used.
  429. .Ed
  430. .Pp
  431. \fBNNN_FCOLORS:\fR specify file-type specific colors:
  432. .Bd -literal
  433. export NNN_FCOLORS='c1e2272e006033f7c6d6abc4'
  434. Specify file-specific colors with decimal xterm 256 color numbers converted
  435. to 2 hex symbols per color.
  436. Order is strict, use 00 to omit/use default terminal color. Defaults:
  437. ------------------------- + --- + -------------
  438. Order | Hex | Color
  439. ------------------------- + --- + -------------
  440. Block device | c1 | DarkSeaGreen1
  441. Char device | e2 | Yellow1
  442. Directory | 27 | DeepSkyBlue1
  443. Executable | 2e | Green1
  444. Regular | 00 | Normal
  445. Hard link | 60 | Plum4
  446. Symbolic link | 33 | Cyan1
  447. Missing OR file details | f7 | Grey62
  448. Orphaned symbolic link | c6 | DeepPink1
  449. FIFO | d6 | Orange1
  450. Socket | ab | MediumOrchid1
  451. Unknown OR 0B regular/exe | c4 | Red1
  452. ------------------------- + --- + -------------
  453. If the terminal supports xterm 256 colors or more, file-specific colors will be rendered.
  454. To force the earlier colorscheme use option -C.
  455. If xterm 256 colors aren't supported, earlier colorscheme will be used.
  456. .Ed
  457. .Pp
  458. \fBNNN_ARCHIVE:\fR archive extensions to be handled silently (default: bzip2, (g)zip, tar).
  459. .Bd -literal
  460. export NNN_ARCHIVE="\\\\.(7z|bz2|gz|tar|tgz|zip)$"
  461. NOTE: Non-default formats may require a third-party utility.
  462. .Ed
  463. .Pp
  464. \fBNNN_SSHFS:\fR specify custom sshfs command with options:
  465. .Bd -literal
  466. export NNN_SSHFS='sshfs -o reconnect,idmap=user,cache_timeout=3600'
  467. NOTE: The options must be comma-separated without any space between them.
  468. .Ed
  469. .Pp
  470. \fBNNN_RCLONE:\fR pass additional options to rclone command:
  471. .Bd -literal
  472. export NNN_RCLONE='rclone mount --read-only --no-checksum'
  473. NOTE: The options must be preceded by "rclone" and max 5 flags are supported.
  474. .Ed
  475. .Pp
  476. \fBNNN_TRASH:\fR trash (instead of \fIrm -rf\fR) files to desktop Trash.
  477. .Bd -literal
  478. export NNN_TRASH=n
  479. # n=1: trash-cli, n=2: gio trash
  480. .Ed
  481. .Pp
  482. \fBNNN_SEL:\fR absolute path to custom selection file.
  483. .Pp
  484. \fBNNN_FIFO:\fR path of a named pipe to write the hovered file path:
  485. .Bd -literal
  486. export NNN_FIFO='/tmp/nnn.fifo'
  487. NOTES:
  488. 1. Overridden by a temporary path with -a option.
  489. 2. If the FIFO file doesn't exist it will be created,
  490. but not removed (unless it is generated by -a option).
  491. .Ed
  492. .Pp
  493. .Em https://github.com/jarun/nnn/wiki/Live-previews
  494. .Pp
  495. \fBNNN_LOCKER:\fR terminal locker program.
  496. .Bd -literal
  497. export NNN_LOCKER='bmon -p wlp1s0'
  498. export NNN_LOCKER='cmatrix'
  499. .Ed
  500. .Pp
  501. \fBNNN_MCLICK:\fR key emulated by a middle mouse click.
  502. .Bd -literal
  503. export NNN_MCLICK='^R'
  504. NOTE: Only the first character is considered if not a \fICtrl+key\fR combo.
  505. .Ed
  506. .Pp
  507. \fBnnn:\fR this is a special variable.
  508. .Bd -literal
  509. Set to the hovered file name before starting the command prompt or spawning a shell.
  510. .Ed
  511. .Pp
  512. \fBNO_COLOR:\fR disable ANSI color output (overridden by \fBNNN_COLORS\fR).
  513. .Sh KNOWN ISSUES
  514. .Nm
  515. may not handle keypresses correctly when used with tmux (see issue #104 for
  516. more details). Set \fBTERM=xterm-256color\fR to address it.
  517. .Sh AUTHORS
  518. .An Arun Prakash Jana Aq Mt engineerarun@gmail.com ,
  519. .An Lazaros Koromilas Aq Mt lostd@2f30.org ,
  520. .An Dimitris Papastamos Aq Mt sin@2f30.org .
  521. .Sh HOME
  522. .Em https://github.com/jarun/nnn