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.8 KiB

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