Use <kbd>^K</kbd> to copy the absolute path of the file under the cursor.
To copy multiple absolute file paths:
- press <kbd>^Y</kbd> (or <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> (or <kbd>Y</kbd>) _again_ to copy the paths and exit the selection mode
The files in the list can now be copied (<kbd>P</kbd>), moved (<kbd>V</kbd>) or removed (<kbd>X</kbd>).
To list the file paths copied to memory press <kbd>y</kbd>.
File paths are copied to the temporary file `DIR/.nnncp`, where `DIR` (by priority) is:
$HOME or,
$TMPDIR or,
/tmp
The path is shown in the help and configuration screen.
#### Filters
Filters support regexes to instantly (search-as-you-type) list the matching entries in the current directory.
@@ -384,41 +407,36 @@ NOTE: Bookmark keys should be single-character to use them in combination with t
#### copy file paths
##### selection
##### to clipboard
Use <kbd>^K</kbd> to copy the absolute path of the file under the cursor.
Along with default copy, `nnn` can pipe the absolute path of the current file or multiple files to a copier script. For example, you can use `xsel` on Linux or `pbcopy` on macOS. Here's a sample [copier script](https://github.com/jarun/nnn/blob/master/scripts/user-scripts/copier.sh).
To copy multiple absolute file paths:
To inform `nnn` of the executable copier script location:
- press <kbd>^Y</kbd> (or <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> (or <kbd>Y</kbd>) _again_ to copy the paths and exit the selection mode
export NNN_COPIER="/path/to/copier.sh"
The files in the list can now be copied (<kbd>P</kbd>), moved (<kbd>V</kbd>) or removed (<kbd>X</kbd>).
##### get selection manually
To list the file paths copied to memory press <kbd>y</kbd>.
NOTE: In the following examples we assume the copy file is at `~/.nnncp`.
File paths are copied to the temporary file `DIR/.nnncp`, where `DIR` (by priority) is:
The file paths are `NUL`-terminated, so additional processing is required to make them usable.
$HOME or,
$TMPDIR or,
/tmp
To get a space-separated list of the file paths in selection:
The path is shown in the help and configuration screen..
cat ~/.nnncp | xargs -0 echo
To use the copied paths from the cmdline, use command substitution. For example, if `DIR` above is `/home/user`:
To get a newline-separated list of the file paths in selection:
# bash/zsh
ls -ltr `cat /home/user/.nnncp`
ls -ltr $(cat /home/user/.nnncp)
ls -ltr `cat /home/user/.nnncp | tr '\0' '\n'`
ls -ltr $(cat /home/user/.nnncp | tr '\0' '\n')
# fish
ls -ltr (cat /home/user/.nnncp)
ls -ltr (cat /home/user/.nnncp | tr '\0' '\n')
An alias may be handy, e.g. when you want to copy selection at the _run a command_ prompt:
alias ncp='cat /home/user/.nnncp'
alias ncp="cat /home/user/.nnncp | tr '\0' '\n'"
so you can easily handle files together:
@@ -429,24 +447,6 @@ so you can easily handle files together:
# fish
ls -ltr (ncp)
##### to clipboard
Along with default copy, `nnn` can pipe the absolute path of the current file or multiple files to a copier script. For example, you can use `xsel` on Linux or `pbcopy` on macOS. Here's a sample [copier script](https://github.com/jarun/nnn/blob/master/scripts/user-scripts/copier.sh).
To inform `nnn` of the executable copier script location:
export NNN_COPIER="/path/to/copier.sh"
##### get selection manually
To get a space-separated list of the file paths in selection, say at the command-prompt: