1
1
mirror of https://github.com/jarun/nnn.git synced 2024-11-22 15:20:59 +03:00

Created Concepts (markdown)

Mischievous Meerkat 2019-09-19 20:43:55 +05:30
parent a0f2a5c560
commit c725b04c60

133
Concepts.md Normal file

@ -0,0 +1,133 @@
![](https://i.imgur.com/4XqgxxW.png)
---
<p align="center"><i>file type indicators, contexts, multi-selection, numeric sort in dual-pane (using dvtm)</i></p>
We understand you are checking out a new terminal utility and getting accustomed can be tricky. However, `nnn` is designed to unfold only when the user is ready. E.g., the interface of `nnn` is intentionally kept minimal so a new user can start with the bare minimum and play around with just 7 familiar keys. (S)he will press <kbd>d</kbd> and eventually add an alias with the `-d` program option only when (s)he wants to dive deeper.
The intention of this wiki is to make the transition simpler and keep the learning curve low. It's editable by anyone. If you find something interesting please share with others. Please visit the [project home](https://github.com/jarun/nnn) for a list of features, installation instructions and general usage.
The name `nnn` is a recursive acronym from _Nnn's Not Noice!_, suggested by a longtime friend.
## Contexts
Contexts serve the purpose of exploring multiple directories simultaneously. 4 contexts are available. The status of the contexts are shown in the top left corner:
- the current context is in reverse video
- other active contexts are underlined
- rest are inactive
On context creation, the state of the previous context is copied. Each context remembers its last visited directory.
#### Context-specific color
Each context can have its own directory color specified in `NNN_CONTEXT_COLORS`.
| Code | Color |
|:---:| --- |
| `0` | Black |
| `1` | Red |
| `2` | Green |
| `3` | Yellow |
| `4` | Blue (default) |
| `5` | Magenta |
| `6` | Cyan |
| `7` | White |
#### Dual pane
Any number of `nnn` instances can be opened simultaneously using a terminal multiplexter. For example, to open 2 instances or a dual pane mode in `dvtm`, run:
dvtm -m '\\' n n
You can also have an alias:
alias n2="dvtm -m '\\\' n n"
or a Bash function to handle arguments:
n2()
{
dvtm -m '\\' "nnn -firs $@" "nnn -firs $@"
}
**Note:** The `dvtm` MOD key is redefined to <kbd>\\</kbd> as the default one (<kbd>^G</kbd>) is also an `nnn` shortcut.
## Filters
Filters support regexes (default) to instantly (search-as-you-type) list the matching entries in the current directory.
Common use cases:
- to list all matches starting with the filter expression, start the expression with a `^` (caret) symbol
- type `\.mkv` to list all MKV files
- use `.*` to match any character (_sort of_ fuzzy search)
There is a program option to filter entries by substring match instead of regex.
There is a program option to execute the current filter as a command when <kbd>^P</kbd> is pressed.
## Navigate-as-you-type
In this mode directories are opened in filter mode, allowing continuous navigation. Works best with the **arrow keys**.
When there's a unique match and it's a directory, `nnn` auto selects the directory and enters it in this mode. Use the relevant program option to disable this behaviour.
This mode takes navigation to the next level when short, unique keypress sequences are possible. For example, to reach `nnn` development directory (located at `~/GitHub/nnn`) from my `$HOME` (which is the default directory the terminal starts in), I use the sequence <kbd>g</kbd><kbd>n</kbd>.
**Note:** <kbd>/</kbd> acts as an additional Leader key when filter is on.
## Selection
Use <kbd>^K</kbd> to select the file under the cursor.
To select multiple files:
- press <kbd>^Y</kbd> to enter selection mode. In this mode it's possible to
- cherry-pick individual files one by one by pressing <kbd>^K</kbd> on each entry (works across directories and contexts); or,
- navigate to another file in the same directory to select a range of files
- press <kbd>^Y</kbd> again to save the selection and exit selection mode.
Press <kbd>^Y</kbd> twice to clear selection.
**Note:** If you are on BSD/macOS, please check the [BSD terminal issue](https://github.com/jarun/nnn/wiki/Troubleshooting#bsd-terminal-issue) with <kbd>^Y</kbd> for workaround.
Selected files are visually indicated by a `+` before the entries.
The selection can now be listed, copied, moved, removed, archived or linked.
Navigate to a target directory then use <kbd>P</kbd> (cp) or <kbd>V</kbd> (mv) to copy or move the selected files.
Absolute paths of the selected files are copied to the temporary file `.selection` in the config directory. The path is shown in the help and configuration screen. If `$NNN_COPIER` is set the file paths are also copied to the system clipboard.
To work with a selection, the paths of the selected files are read from the `.selection` file. So the file can be edited to remove any entries. However, this is not recommended.
The `.selection` file is shared between multiple instances of `nnn`. The most recent instance writing to the file overwrites the entries from earlier writes.
## File indicators
The following indicators are used in the detail view:
| Indicator | File type |
|:---:| --- |
| `/` | Directory |
| `*` | Executable |
| <code>&#124;</code> | Fifo |
| `=` | Socket |
| `@` | Symbolic link |
| `b` | Block device |
| `c` | Character device |
| `?` | Unknown |
## Status bar symbols
| Symbol | Meaning |
|:---:| --- |
| `x/y` | current file num / total |
| `(n)` | number of selected files |
| `Y` | selection mode |
| `T` | modification time sorted |
| `A` | access time sorted |
| `S` | size sorted |
| `E` | file extension sorted |
| `du` | disk usage |
| `au` | apparent disk usage |