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

Updated Concepts (markdown)

Terminator X 2021-10-23 03:27:16 +05:30
parent 4fdf299abb
commit 8df5f3cb27

@ -256,6 +256,32 @@ The following special variables can be accessed from the command prompt or a spa
E.g. to copy the hovered file in context 1 to the directory open in context 3, run `cp "$f1" "$d3"`.
Selection can be accessed from the command prompt:
| Variable | Substitution |
|:---:| --- |
| `%j` | repeat the command with `%j` substituted by each selected file path (all occurrances of`%j` are substituted) |
| `%J` | run the command only once with the last `%J` substituted by all selected file paths |
E.g.
Look up a string in each file in selection:
```sh
printf "Searching for string in %s\n" "%j"; grep "string" "%j"
```
Archive all files in selection:
```sh
tar uvf archive.tar %J
```
Notes:
1. You can only use either `%j` or `%J` inside a single command. If both are encountered the prompt will close. No command will be executed.
2. When using `%J` `nnn` won't quote the file paths from selection. Quoting `%J` will just place quotes around the entire selection, it won't quote each item individually.
## Design
`nnn` (the core C utility) is, generally speaking, _feature-restricted_. It includes features which you _really_ need so it can remain light enough to finish your workflow accurately before your train of thought is lost.