My build of nnn with minor changes
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

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