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.
 
 
 
 
 
 

462 line
14 KiB

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