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.

README.md 11 KiB

8 years ago
8 years ago
7 years ago
7 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. ## nnn
  2. Noice is Not Noice, a noicer fork...
  3. <p align="center">
  4. <a href="https://github.com/jarun/nnn/releases/latest"><img src="https://img.shields.io/github/release/jarun/nnn.svg?maxAge=600" alt="Latest release" /></a>
  5. <a href="https://aur.archlinux.org/packages/nnn"><img src="https://img.shields.io/aur/version/nnn.svg?maxAge=600" alt="AUR" /></a>
  6. <a href="https://launchpad.net/~twodopeshaggy/+archive/ubuntu/jarun/"><img src="https://img.shields.io/badge/ubuntu-PPA-blue.svg?maxAge=2592000" alt="Ubuntu PPA" /></a>
  7. <a href="https://github.com/jarun/nnn/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-BSD%202--Clause-yellow.svg?maxAge=2592000" alt="License" /></a>
  8. <a href="https://travis-ci.org/jarun/nnn"><img src="https://travis-ci.org/jarun/nnn.svg?branch=master" alt="Build Status" /></a>
  9. </p>
  10. [![nnn-demo-20170405.mp4](https://i.imgur.com/VGA6IcB.png)](https://static.zhimingwang.org/nnn-demo-20170405.mp4 "Click for some action!")
  11. <p align="center"><a href="https://static.zhimingwang.org/nnn-demo-20170405.mp4">Click for some action!</a></p>
  12. ### Table of Contents
  13. - [Introduction](#introduction)
  14. - [Why fork?](#why-fork)
  15. - [Original features](#original-features)
  16. - [nnn toppings](#nnn-toppings)
  17. - [Behaviour and navigation](#behaviour-and-navigation)
  18. - [File association](#file-association)
  19. - [Optimization](#optimization)
  20. - [Performance](#performance)
  21. - [Installation](#installation)
  22. - [Quickstart](#quickstart)
  23. - [Usage](#usage)
  24. - [Cmdline options](#cmdline-options)
  25. - [Keyboard shortcuts](#keyboard-shortcuts)
  26. - [Filters](#filters)
  27. - [File type abbreviations](#file-type-abbreviations)
  28. - [Help](#help)
  29. - [How to](#how-to)
  30. - [cd on quit](#cd-on-quit)
  31. - [Copy current file path to clipboard](#copy-current-file-path-to-clipboard)
  32. - [Change file associations](#change-file-associations)
  33. - [Developers](#developers)
  34. ### Introduction
  35. 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.
  36. 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).
  37. Follow the instructions in the [quickstart](#quickstart) section and see how nnn simplifies those long desktop sessions.
  38. Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/issues/1).
  39. <p align="right">
  40. <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>
  41. </p>
  42. ### Why fork?
  43. I chose to fork because:
  44. - 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.
  45. - 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.
  46. ### Original features
  47. - Super-easy navigation
  48. - Pre-defined associations for different file types
  49. - Jump to home directory
  50. - Filter contents in current directory
  51. - Show/hide hidden files
  52. - Sort entries by modification time (newest to oldest)
  53. - Spawn a `SHELL` in current directory (fallback sh)
  54. - Run `top`
  55. - Edit a file with `EDITOR` (fallback vi)
  56. - Page through a file in `PAGER` (fallback less)
  57. ### nnn toppings
  58. #### Behaviour and navigation
  59. - Detail view (default: disabled) with:
  60. - file type (directory, regular, symlink etc.)
  61. - modification time
  62. - human-readable file size
  63. - current item in reverse video
  64. - number of items in current directory
  65. - full name of currently selected file in 'bar'
  66. - Show details of the currently selected file (stat, file)
  67. - Disk usage analyzer mode (within the same fs, doesn't follow symlinks)
  68. - Directories first (even with sorting)
  69. - Sort numeric names in numeric order
  70. - Case-insensitive alphabetic content listing instead of upper case first
  71. - Key `-` to jump to last visited directory
  72. - Roll over at the first and last entries of a directory (with Up/Down keys)
  73. - Removed navigation restriction with relative paths (and let permissions handle it)
  74. - Sort entries by file size (largest to smallest)
  75. - Shortcut to invoke file name copier (set using environment variable `NNN_COPIER`)
  76. - Change to last visited directory on quit
  77. #### File association
  78. - Set `NNN_OPENER` to let a desktop opener handle it all. E.g.:
  79. export NNN_OPENER=xdg-open
  80. export NNN_OPENER="gio open"
  81. export NNN_OPENER=gvfs-open
  82. - Selective file associations (ignored if `NNN_OPENER` is set):
  83. - Associate plain text files (determined using file) with vi
  84. - Associate common audio and video mimes with mpv
  85. - Associate PDF files with [zathura](https://pwmt.org/projects/zathura/)
  86. - Removed `less` as default file opener (there is no universal standalone opener utility)
  87. - You can customize further (see [how to change file associations](#change-file-associations))
  88. - `NNN_FALLBACK_OPENER` is the last line of defense:
  89. - If the executable in static file association is missing
  90. - If a file type was not handled in static file association
  91. - This may be the best option to set your desktop opener to
  92. - To enable the desktop file manager key, set `NNN_DE_FILE_MANAGER`. E.g.:
  93. export NNN_DE_FILE_MANAGER=thunar
  94. #### Optimization
  95. - All redundant buffer removal
  96. - All frequently used local chunks now static
  97. - Removed some redundant string allocation and manipulation
  98. - Simplified some roundabout procedures
  99. - Compiler warnings fixed
  100. - strip the final binary
  101. ### Performance
  102. nnn vs. ncdu memory usage while listing `/usr/bin` with 1439 entries in disk usage analyzer mode, sorted by total content size:
  103. ```
  104. PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
  105. 10406 vaio 20 0 53808 42284 2248 S 0.0 0.8 0:00.82 ncdu
  106. 10409 vaio 20 0 20452 9172 2356 S 0.0 0.2 0:00.83 nnn -d
  107. ```
  108. nnn vs. ranger memory usage while viewing a directory with 10,178 files, sorted by size:
  109. ```
  110. PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
  111. 22465 vaio 20 0 233956 192136 7896 S 0.0 3.9 0:05.31 /usr/bin/python -O /usr/bin/ranger
  112. 21743 vaio 20 0 55984 44648 2468 S 0.0 0.9 0:01.17 nnn -d
  113. ```
  114. ### Installation
  115. nnn needs libreadline and libncursesw (on Linux or ncurses on OS X) and standard libc.
  116. - If you are using **Homebrew**, run:
  117. brew install jarun/nnn/nnn
  118. - Packages are available on
  119. - [AUR](https://aur.archlinux.org/packages/nnn/)
  120. - [Ubuntu PPA](https://launchpad.net/~twodopeshaggy/+archive/ubuntu/jarun/)
  121. - To compile and install, download the [latest stable release](https://github.com/jarun/nnn/releases/latest) or clone this repository (*risky*). Run:
  122. $ make
  123. $ sudo make install
  124. ### Quickstart
  125. Add the following to your shell's rc file for the best experience:
  126. - If you want to open nnn in detail mode each time:
  127. alias n='nnn -d'
  128. - Set your preferred desktop opener as fallback. E.g.:
  129. export NNN_FALLBACK_OPENER=xdg-open
  130. - Set a desktop file manager to open directories with (if you need). E.g.:
  131. export NNN_DE_FILE_MANAGER=thunar
  132. - Start nnn.
  133. n
  134. ### Usage
  135. #### Cmdline options
  136. usage: nnn [-d] [-S] [-v] [h] [PATH]
  137. The missing terminal file browser for X.
  138. positional arguments:
  139. PATH directory to open [default: current dir]
  140. optional arguments:
  141. -d start in detail view mode
  142. -S start in disk usage analyzer mode
  143. -v show program version and exit
  144. -h show this help and exit
  145. `>` indicates the currently selected entry in nnn.
  146. #### Keyboard shortcuts
  147. | Key | Function |
  148. | --- | --- |
  149. | `Up`, `k`, `^P` | Previous entry |
  150. | `Down`, `j`, `^N` | Next entry |
  151. | `PgUp`, `^U` | Scroll half page up |
  152. | `PgDn`, `^D` | Scroll half page down |
  153. | `Home`, `g`, `^`, `^A` | Jump to first entry |
  154. | `End`, `G`, `$`, `^E` | Jump to last entry |
  155. | `Right`, `Enter`, `l`, `^M` | Open file or enter dir |
  156. | `Left`, `Backspace`, `h`, `^H` | Go to parent dir |
  157. | `~` | Jump to HOME dir |
  158. | `-` | Jump to last visited dir |
  159. | `o` | Open dir in desktop file manager |
  160. | `/`, `&` | Filter dir contents |
  161. | `c` | Show change dir prompt |
  162. | `d` | Toggle detail view |
  163. | `D` | Toggle current file details screen |
  164. | `.` | Toggle hide .dot files |
  165. | `s` | Toggle sort by file size |
  166. | `S` | Toggle disk usage analyzer mode |
  167. | `t` | Toggle sort by modified time |
  168. | `!` | Spawn `SHELL` in `PWD` (fallback sh) |
  169. | `z` | Run `top` |
  170. | `e` | Edit entry in `EDITOR` (fallback vi) |
  171. | `p` | Open entry in `PAGER` (fallback less) |
  172. | `^K` | Invoke file name copier |
  173. | `^L` | Force a redraw |
  174. | `?` | Toggle help screen |
  175. | `q` | Quit |
  176. | `Q` | Quit and change directory |
  177. #### Filters
  178. 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.
  179. Filters do not stack on top of each other. They are applied anew every time.
  180. An empty filter expression resets the filter.
  181. If nnn is invoked as root the default filter will also match hidden files.
  182. #### File type abbreviations
  183. The following abbreviations are used in the detail view:
  184. | Symbol | File Type |
  185. | --- | --- |
  186. | `/` | Directory |
  187. | `*` | Executable |
  188. | <code>&#124;</code> | Fifo |
  189. | `=` | Socket |
  190. | `@` | Symbolic Link |
  191. | `b` | Block Device |
  192. | `c` | Character Device |
  193. #### Help
  194. $ man nnn
  195. To lookup keyboard shortcuts at runtime, press `?`.
  196. ### How to
  197. #### cd on quit
  198. Pick the appropriate file for your shell from [misc/quitcd](https://github.com/jarun/nnn/tree/master/misc/quitcd) and add the contents to your shell's rc file. You'll need to spawn a new shell for the change to take effect. You should start nnn as `n` (or modify the function name to something else).
  199. As you might notice, nnn uses the environment variable `NNN_TMPFILE` to write the last visited directory path. You can change it.
  200. #### Copy current file path to clipboard
  201. 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.
  202. Sample Linux copier script:
  203. #!/bin/sh
  204. echo -n $1 | xsel --clipboard --input
  205. export `NNN_OPENER`:
  206. export NNN_COPIER="/home/vaio/copier.sh"
  207. Start nnn and use `^K` to copy the absolute path (from `/`) of the file under the cursor to clipboard.
  208. #### Change file associations
  209. 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.
  210. ### Developers
  211. 1. Copyright © 2014-2016 Lazaros Koromilas
  212. 2. Copyright © 2014-2016 Dimitris Papastamos
  213. 3. Copyright © 2016-2017 [Arun Prakash Jana](https://github.com/jarun)