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.
 
 
 
 
 
 

470 line
14 KiB

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