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.

README.md 9.3 KiB

8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
7 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
7 yıl önce
8 yıl önce
8 yıl önce
7 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
8 yıl önce
7 yıl önce
8 yıl önce
7 yıl önce
8 yıl önce
8 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. ## nnn
  2. Noice is Not Noice, a noicer fork...
  3. <br>
  4. [![nnn-demo-20170405.mp4](https://i.imgur.com/VGA6IcB.png)](https://static.zhimingwang.org/nnn-demo-20170405.mp4 "Click for some action!")
  5. <p align="center"><a href="https://static.zhimingwang.org/nnn-demo-20170405.mp4">Click for some action!</a></p>
  6. ### Table of Contents
  7. - [Introduction](#introduction)
  8. - [Why fork?](#why-fork)
  9. - [Original features](#original-features)
  10. - [nnn toppings](#nnn-toppings)
  11. - [Behaviour and navigation](#behaviour-and-navigation)
  12. - [File association](#file-association)
  13. - [Optimization](#optimization)
  14. - [Performance](#performance)
  15. - [Installation](#installation)
  16. - [Quickstart](#quickstart)
  17. - [Usage](#usage)
  18. - [Keyboard shortcuts](#keyboard-shortcuts)
  19. - [Filters](#filters)
  20. - [File type abbreviations](#file-type-abbreviations)
  21. - [Help](#help)
  22. - [Copy current file path to clipboard](#copy-current-file-path-to-clipboard)
  23. - [Change file associations](#change-file-associations)
  24. ### Introduction
  25. nnn is a fork of [noice](http://git.2f30.org/noice/), a blazing-fast lightweight terminal file browser with easy keyboard shortcuts for navigation, opening files and running tasks. noice is developed considering terminal based systems. There is no config file and mime associations are hard-coded. However, the incredible user-friendliness and speed make it a perfect utility on modern distros.
  26. nnn can use the default desktop opener at runtime. It adds new navigation options, enhanced DE integration, a disk usage analyzer mode, comprehensive file details and much more. For a complete list, see [nnn toppings](#nnn-toppings).
  27. Follow the instructions in the [quickstart](#quickstart) section and see how nnn simplifies those long desktop sessions.
  28. Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/issues/1).
  29. <p align="right">
  30. <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RMLTQ76JSXJ4Q"><img src="https://tuxtricks.files.wordpress.com/2016/12/donate.png" alt="Donate via PayPal!" title="Donate via PayPal!" /></a>
  31. </p>
  32. ### Why fork?
  33. I chose to fork because:
  34. - one can argue my approach deviates from the goal of the original project - keep the utility `suckless`. In my opinion evolution is the taste of time.
  35. - I would like to have a bit of control on what features are added in the name of desktop integration. A feature-bloat is the last thing in my mind.
  36. ### Original features
  37. - Super-easy navigation
  38. - Pre-defined associations for different file types
  39. - Jump to home directory
  40. - Filter contents in current directory
  41. - Show/hide hidden files
  42. - Sort entries by modification time (newest to oldest)
  43. - Spawn a `SHELL` in current directory (fallback sh)
  44. - Run `top`
  45. - Edit a file with `EDITOR` (fallback vi)
  46. - Page through a file in `PAGER` (fallback less)
  47. ### nnn toppings
  48. #### Behaviour and navigation
  49. - Detail view (default: disabled) with:
  50. - file type (directory, regular, symlink etc.)
  51. - modification time
  52. - human-readable file size
  53. - current item in reverse video
  54. - number of items in current directory
  55. - full name of currently selected file in 'bar'
  56. - Show details of the currently selected file (stat, file)
  57. - Disk usage analyzer mode (within the same fs, doesn't follow symlinks)
  58. - Directories first (even with sorting)
  59. - Sort numeric names in numeric order
  60. - Case-insensitive alphabetic content listing instead of upper case first
  61. - Key `-` to jump to last visited directory
  62. - Roll over at the first and last entries of a directory (with Up/Down keys)
  63. - Removed navigation restriction with relative paths (and let permissions handle it)
  64. - Sort entries by file size (largest to smallest)
  65. - Shortcut to invoke file name copier (set using environment variable `NNN_COPIER`)
  66. #### File association
  67. - Set `NNN_OPENER` to let a desktop opener handle it all. E.g.:
  68. export NNN_OPENER=xdg-open
  69. export NNN_OPENER="gio open"
  70. export NNN_OPENER=gvfs-open
  71. - Selective file associations (ignored if `NNN_OPENER` is set):
  72. - Associate plain text files (determined using file) with vi
  73. - Associate common audio and video mimes with mpv
  74. - Associate PDF files with [zathura](https://pwmt.org/projects/zathura/)
  75. - Removed `less` as default file opener (there is no universal standalone opener utility)
  76. - You can customize further (see [how to change file associations](#change-file-associations))
  77. - `NNN_FALLBACK_OPENER` is the last line of defense:
  78. - If the executable in static file association is missing
  79. - If a file type was not handled in static file association
  80. - This may be the best option to set your desktop opener to
  81. - To enable the desktop file manager key, set `NNN_DE_FILE_MANAGER`. E.g.:
  82. export NNN_DE_FILE_MANAGER=thunar
  83. #### Optimization
  84. - All redundant buffer removal
  85. - All frequently used local chunks now static
  86. - Removed some redundant string allocation and manipulation
  87. - Simplified some roundabout procedures
  88. - Compiler warnings fixed
  89. - strip the final binary
  90. ### Performance
  91. nnn vs. ncdu memory usage while listing `/usr/bin` with 1439 entries in disk usage analyzer mode, sorted by total content size:
  92. ```
  93. PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
  94. 10406 vaio 20 0 53808 42284 2248 S 0.0 0.8 0:00.82 ncdu
  95. 10409 vaio 20 0 20452 9172 2356 S 0.0 0.2 0:00.83 nnn -d
  96. ```
  97. nnn vs. ranger memory usage while viewing a directory with 10,178 files, sorted by size:
  98. ```
  99. PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
  100. 22465 vaio 20 0 233956 192136 7896 S 0.0 3.9 0:05.31 /usr/bin/python -O /usr/bin/ranger
  101. 21743 vaio 20 0 55984 44648 2468 S 0.0 0.9 0:01.17 nnn -d
  102. ```
  103. ### Installation
  104. nnn needs a curses implementation and standard libc.
  105. - If you are using Homebrew, run:
  106. brew install jarun/nnn/nnn
  107. - Packages are available on
  108. - [AUR](https://aur.archlinux.org/packages/nnn/)
  109. - [Ubuntu PPA](https://launchpad.net/~twodopeshaggy/+archive/ubuntu/jarun/)
  110. - To compile and install, download the [latest stable release](https://github.com/jarun/nnn/releases/latest) or clone this repository (*risky*). Run:
  111. $ make
  112. $ sudo make install
  113. ### Quickstart
  114. Add the following to your shell's rc file for the best experience:
  115. - If you want to open nnn in detail mode each time:
  116. alias n='nnn -d'
  117. - Set your preferred desktop opener as fallback. E.g.:
  118. export NNN_FALLBACK_OPENER=xdg-open
  119. - Set a desktop file manager to open directories with (if you need). E.g.:
  120. export NNN_DE_FILE_MANAGER=thunar
  121. - Start nnn.
  122. n
  123. ### Usage
  124. Start nnn (default dir: current directory):
  125. $ nnn [-d] [-S] [-v] [dir]
  126. -d: start in detail view mode
  127. -S: start in disk usage analyzer mode
  128. -v: show version and exit
  129. `>` indicates the currently selected entry in nnn.
  130. ### Keyboard shortcuts
  131. | Key | Function |
  132. | --- | --- |
  133. | `Up`, `k`, `^P` | Previous entry |
  134. | `Down`, `j`, `^N` | Next entry |
  135. | `PgUp`, `^U` | Scroll half page up |
  136. | `PgDn`, `^D` | Scroll half page down |
  137. | `Home`, `g`, `^`, `^A` | Jump to first entry |
  138. | `End`, `G`, `$`, `^E` | Jump to last entry |
  139. | `Right`, `Enter`, `l`, `^M` | Open file or enter dir |
  140. | `Left`, `Backspace`, `h`, `^H` | Go to parent dir |
  141. | `~` | Jump to HOME dir |
  142. | `-` | Jump to last visited dir |
  143. | `o` | Open dir in desktop file manager |
  144. | `/`, `&` | Filter dir contents |
  145. | `c` | Show change dir prompt |
  146. | `d` | Toggle detail view |
  147. | `D` | Toggle current file details screen |
  148. | `.` | Toggle hide .dot files |
  149. | `s` | Toggle sort by file size |
  150. | `S` | Toggle disk usage analyzer mode |
  151. | `t` | Toggle sort by modified time |
  152. | `!` | Spawn `SHELL` in `PWD` (fallback sh) |
  153. | `z` | Run `top` |
  154. | `e` | Edit entry in `EDITOR` (fallback vi) |
  155. | `p` | Open entry in `PAGER` (fallback less) |
  156. | `^K` | Invoke file name copier |
  157. | `^L` | Force a redraw |
  158. | `?` | Toggle help screen |
  159. | `q` | Quit |
  160. ### Filters
  161. Filters support regexes to display only the matched entries in the current directory view. This effectively allows searching through the directory tree for a particular entry.
  162. Filters do not stack on top of each other. They are applied anew every time.
  163. An empty filter expression resets the filter.
  164. If nnn is invoked as root the default filter will also match hidden files.
  165. ### File type abbreviations
  166. The following abbreviations are used in the detail view:
  167. | Symbol | File Type |
  168. | --- | --- |
  169. | `/` | Directory |
  170. | `*` | Executable |
  171. | <code>&#124;</code> | Fifo |
  172. | `=` | Socket |
  173. | `@` | Symbolic Link |
  174. | `b` | Block Device |
  175. | `c` | Character Device |
  176. ### Help
  177. $ man nnn
  178. To lookup keyboard shortcuts at runtime, press `?`.
  179. ### Copy current file path to clipboard
  180. nnn can pipe the absolute path of the current file to a copier script. For example, you can use `xsel` on Linux or `pbcopy` on OS X.
  181. Sample Linux copier script:
  182. #!/bin/sh
  183. echo -n $1 | xsel --clipboard --input
  184. export `NNN_OPENER`:
  185. export NNN_COPIER="/home/vaio/copier.sh"
  186. Start nnn and use `^K` to copy the absolute path (from `/`) of the file under the cursor to clipboard.
  187. ### Change file associations
  188. If you want to set custom applications for certain mime types, or change the ones set already (e.g. vi, mpv, zathura), modify the `assocs` structure in [config.def.h](https://github.com/jarun/nnn/blob/master/config.def.h) (it's easy). Then re-compile and install.