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

547 рядки
17 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. Listing input stream is given a higher priority to persistent sessions. Use
  201. session option \fIrestore\fR to restore the persistent session at runtime.
  202. .Pp
  203. All the session files are located by session name in the directory
  204. .Pp
  205. \fB${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions\fR
  206. .Pp
  207. "@" is the "last session" file.
  208. .Sh FILTERS
  209. Filters are strings (or regex patterns) to find matching entries in the current
  210. directory instantly (\fIsearch-as-you-type\fR). Matches are case-insensitive by
  211. default. The last filter in each context is persisted at runtime or in saved
  212. sessions.
  213. .Pp
  214. Special keys at filter prompt:
  215. .Bd -literal
  216. -------- + ---------------------------------------
  217. Key | Function
  218. -------- + ---------------------------------------
  219. ^char | Usual keybind functionality
  220. Esc | Exit filter prompt but skip dir refresh
  221. Alt+Esc | Exit filter prompt and refresh dir
  222. -------- + ---------------------------------------
  223. .Ed
  224. .Pp
  225. Special keys at \fBempty filter prompt\fR:
  226. .Bd -literal
  227. ------ + ---------------------------------------
  228. Key | Function
  229. ------ + ---------------------------------------
  230. ? | Show help and config screen
  231. / | Toggle between string and regex
  232. : | Toggle case-sensitivity
  233. ^L | Clear filter (\fIif prompt is non-empty\fR)
  234. | OR apply last filter
  235. ------ + ---------------------------------------
  236. .Ed
  237. .Pp
  238. Additional special keys at \fBempty filter prompt\fR
  239. in \fBtype-to-nav\fR mode:
  240. .Bd -literal
  241. ------ + ------------------------
  242. Key | Function
  243. ------ + ------------------------
  244. ' | Go to first non-dir file
  245. + | Toggle auto-advance
  246. , | Mark CWD
  247. - | Go to last visited dir
  248. . | Show hidden files
  249. ; | Run a plugin by its key
  250. = | Launch a GUI application
  251. > | Export file list
  252. @ | Visit start dir
  253. ] | Show command prompt
  254. ` | Visit /
  255. ~ | Go HOME
  256. ------ + ------------------------
  257. .Ed
  258. .Pp
  259. Common regex use cases:
  260. .Pp
  261. (1) To list all matches starting with the filter expression,
  262. start the expression with a '^' (caret) symbol.
  263. .br
  264. (2) Type '\\.mkv' to list all MKV files.
  265. .br
  266. (3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
  267. .br
  268. (4) Exclude filenames having 'nnn' (compiled with PCRE lib): '^(?!nnn)'
  269. .Pp
  270. In the \fItype-to-nav\fR mode directories are opened in filter
  271. mode, allowing continuous navigation.
  272. .br
  273. When there's a unique match and it's a directory,
  274. .Nm
  275. auto selects the directory and enters it in this mode. Use the relevant
  276. program option to disable this behaviour.
  277. .Sh SELECTION
  278. .Nm
  279. allows file selection across directories and contexts!
  280. .Pp
  281. There are 3 groups of keybinds to add files to selection:
  282. .Pp
  283. (1) hovered file selection toggle
  284. - deselects if '+' is visible before the entry, else adds to selection
  285. .br
  286. (2) add a range of files to selection
  287. - repeat the range key on the same entry twice to clear selection completely
  288. .br
  289. (3) add all files in the current directory to selection
  290. .Pp
  291. A selection can be edited, copied, moved, removed, archived or linked.
  292. .Pp
  293. Absolute paths of the selected files are copied to \fB.selection\fR file in
  294. the config directory. The selection file is shared between multiple program
  295. instances. The most recent instance writing to the file overwrites the entries
  296. from earlier writes. If you have 2 instances if
  297. .Nm
  298. \fIopen\fR in 2 panes of a terminal multiplexer, you can select in one pane and
  299. use the selection (e.g. to copy or move) in the other pane (if the instance
  300. doesn't have any local selection already).
  301. .Pp
  302. .Nm
  303. clears the selection after file removal, batch-rename and link creation with
  304. selection. However, it is retained after archive creation with selection as
  305. the user may want to delete the archived files next.
  306. .Pp
  307. To edit the selection use the _edit selection_ key. Use this key to remove a
  308. file from selection after you navigate away from its directory. Editing doesn't
  309. end the selection mode. You can add more files to the selection and edit the
  310. list again. If no file is selected in the current session, this option attempts
  311. to list the selection file.
  312. .Sh FIND AND LIST
  313. There are two ways to search and list:
  314. .Pp
  315. - feed a list of file paths as input
  316. .br
  317. - search using a plugin (e.g. \fIfinder\fR) and list the results
  318. .Pp
  319. File paths must be NUL-separated ('\\0'). Paths and can be relative to the
  320. current directory or absolute. Invalid paths in the input are ignored. Input
  321. limit is 65,536 paths or 256 MiB of data.
  322. .Pp
  323. To list the input stream, start
  324. .Nm
  325. by writing to its standard input. E.g., to list files in current
  326. directory larger than
  327. 1M:
  328. .Bd -literal
  329. find -maxdepth 1 -size +1M -print0 | nnn
  330. .Ed
  331. .Pp
  332. or redirect a list from a file:
  333. .Bd -literal
  334. nnn < files.txt
  335. .Ed
  336. .Pp
  337. Handy bash/zsh shell function to list files by mime-type in current directory:
  338. .Bd -literal
  339. # to show video files, run: list video
  340. list ()
  341. {
  342. find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s\0", $1}' | nnn
  343. }
  344. .Ed
  345. .Pp
  346. A temporary directory will be created containing symlinks to the given
  347. paths. Any action performed on these symlinks will be performed only on their
  348. targets, after which they might become invalid.
  349. .Pp
  350. Right arrow or 'l' on a symlink in the listing dir takes to the target
  351. file. Press '-' to return to the listing dir. Press 'Enter' to open the symlink.
  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