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 6.9 KiB

8 years ago
8 years ago
7 years ago
8 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
8 years ago
8 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
8 years ago
8 years ago
7 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
7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. ## nnn
  2. Noice is Not Noice, a noicer fork...
  3. [![nnn_demo.gif](http://s23.postimg.org/fjmcngsux/nnn_demo.gif)](http://postimg.org/image/6olicy42f/)
  4. ### Table of Contents
  5. - [Introduction](#introduction)
  6. - [Why fork?](#why-fork)
  7. - [Original features](#original-features)
  8. - [nnn toppings](#nnn-toppings)
  9. - [Installation](#installation)
  10. - [Usage](#usage)
  11. - [Keyboard shortcuts](#keyboard-shortcuts)
  12. - [Filters](#filters)
  13. - [File type abbreviations](#file-type-abbreviations)
  14. - [Help](#help)
  15. - [Copy current file path to clipboard](#copy-current-file-path-to-clipboard)
  16. - [Change file associations](#change-file-associations)
  17. ### Introduction
  18. nnn is a fork of [noice](http://git.2f30.org/noice/), a blazing-fast terminal file browser with easy keyboard shortcuts for navigation, opening files and running tasks. It is developed with terminal based systems in mind. However, the incredible user-friendliness and speed make it a perfect utility on modern distros.
  19. The only issue with noice is hard-coded file associations. There is no config file (better performance and simpler to maintain) and one has to modify the source to change associations (see [how to change file associations](#change-file-associations)). nnn solves the problem by adding the flexibility of using the default desktop opener at runtime. There are several other improvements too (see [fork-toppings](#fork-toppings)).
  20. You can try
  21. alias n='nnn -d'
  22. and see how nnn simplifies those long desktop sessions.
  23. Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/issues/1).
  24. ### Why fork?
  25. I chose to fork because:
  26. - 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.
  27. - 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.
  28. ### Original features
  29. - Super-easy navigation
  30. - Open files with default-associated programs
  31. - Jump to home directory
  32. - Filter contents in current directory
  33. - Show/hide hidden files
  34. - Sort entries by modification time (newest to oldest)
  35. - Spawn a `SHELL` in current directory (fallback sh)
  36. - Run `top`
  37. - Edit a file with `EDITOR` (fallback vi)
  38. - Page through a file in `PAGER` (fallback less)
  39. ### nnn toppings
  40. - Behaviour and navigation
  41. - Detail view (default: disabled) with:
  42. - file type
  43. - modification time
  44. - human-readable file size
  45. - current item in reverse video
  46. - number of items in current directory
  47. - full name of currently selected file
  48. - Show details of the currently selected file (stat, file)
  49. - Directories first
  50. - Sort numeric names in numeric order
  51. - Case-insensitive alphabetic content listing instead of upper case first
  52. - Roll over at the first and last entries of a directory (with Up/Down keys)
  53. - Removed navigation restriction with relative paths (and let permissions handle it)
  54. - Sort entries by file size (largest to smallest)
  55. - Shortcut to invoke file name copier (set using environment variable `NNN_COPIER`)
  56. - File associations
  57. - Environment variable `NNN_OPENER` to let desktop opener handle it all. E.g.:
  58. export NNN_OPENER=xdg-open
  59. export NNN_OPENER=gnome-open
  60. export NNN_OPENER=gvfs-open
  61. - Selective file associations (ignored if `NNN_OPENER` is set):
  62. - Associate plain text files with vi (using `file` command)
  63. - Remove video file associations (to each his own favourite video player)
  64. - Associate common audio mimes with mpv
  65. - Associate PDF files with [zathura](https://pwmt.org/projects/zathura/)
  66. - Use environment variable `NNN_FALLBACK_OPENER` to open other non-associated files
  67. - Removed `less` as default file opener (there is no universal standalone opener utility)
  68. - Optimizations
  69. - Efficient memory usage, 0 malloc()
  70. - Complete redundant buffer removal
  71. - All frequently used local chunks now static
  72. - Removed some redundant string allocation and manipulation
  73. - Simplified some roundabout procedures
  74. - `-O3` level optimization, warning fixes
  75. - Added compilation flag `-march=native`
  76. - Remove generated config.h on `make clean`
  77. - strip the final binary
  78. ### Installation
  79. nnn needs a curses implementation and standard libc.
  80. Download the [latest master](https://github.com/jarun/nnn/archive/master.zip) or clone this repository. Compile and install:
  81. $ make
  82. $ sudo make install
  83. No plans of packaging at the time.
  84. ### Usage
  85. Start nnn (default: current directory):
  86. $ nnn [-d] [path_to_dir]
  87. -d: open in detail view mode
  88. `>` indicates the currently selected entry in nnn.
  89. ### Keyboard shortcuts
  90. | Key | Function |
  91. | --- | --- |
  92. | `Up`, `k`, `^P` | Previous entry |
  93. | `Down`, `j`, `^N` | Next entry |
  94. | `PgUp`, `^U` | Scroll half page up |
  95. | `PgDn`, `^D` | Scroll half page down |
  96. | `Home`, `g`, `^`, `^A` | Jump to first entry |
  97. | `End`, `G`, `$`, `^E` | Jump to last entry |
  98. | `Right`, `Enter`, `l`, `^M` | Open file or enter dir |
  99. | `Left`, `Backspace`, `h`, `^H` | Go to parent dir |
  100. | `~` | Jump to HOME dir |
  101. | `/`, `&` | Filter dir contents |
  102. | `c` | Show change dir prompt |
  103. | `d` | Toggle detail view |
  104. | `D` | Show details of selected file |
  105. | `.` | Toggle hide .dot files |
  106. | `s` | Toggle sort by file size |
  107. | `t` | Toggle sort by modified time |
  108. | `!` | Spawn `SHELL` in `PWD` (fallback sh) |
  109. | `z` | Run `top` |
  110. | `e` | Edit entry in `EDITOR` (fallback vi) |
  111. | `p` | Open entry in `PAGER` (fallback less) |
  112. | `^K` | Invoke file name copier |
  113. | `^L` | Force a redraw |
  114. | `?` | Show help |
  115. | `q` | Quit |
  116. ### Filters
  117. 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.
  118. Filters do not stack on top of each other. They are applied anew every time.
  119. An empty filter expression resets the filter.
  120. If nnn is invoked as root the default filter will also match hidden files.
  121. ### File type abbreviations
  122. The following abbreviations are used in the detail view:
  123. | Symbol | File Type |
  124. | --- | --- |
  125. | `/` | Directory |
  126. | `*` | Executable |
  127. | `|` | Fifo |
  128. | `=` | Socket |
  129. | `@` | Symbolic Link |
  130. | `b` | Block Device |
  131. | `c` | Character Device |
  132. ### Help
  133. $ man nnn
  134. ### Copy current file path to clipboard
  135. 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.
  136. Sample Linux copier script:
  137. #!/bin/sh
  138. echo -n $1 | xsel --clipboard --input
  139. export `NNN_OPENER`:
  140. export NNN_COPIER="/home/vaio/copier.sh"
  141. Start nnn and use `Ctrl-k` to copy the absolute path (from `/`) of the file under the cursor to clipboard.
  142. ### Change file associations
  143. 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.