mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Document native cp, mv, rm
This commit is contained in:
parent
4407f29dd3
commit
f41ed544d5
35
README.md
35
README.md
|
@ -60,10 +60,9 @@ It runs on Linux, OS X, Raspberry Pi, Cygwin, Linux subsystem for Windows and Te
|
||||||
- [How to](#how-to)
|
- [How to](#how-to)
|
||||||
- [add bookmarks](#add-bookmarks)
|
- [add bookmarks](#add-bookmarks)
|
||||||
- [copy file paths](#copy-file-paths)
|
- [copy file paths](#copy-file-paths)
|
||||||
- [selection shortcuts](#selection-shortcuts)
|
- [selection mode](#selection-mode)
|
||||||
- [default copy](#default-copy)
|
- [default copy](#default-copy)
|
||||||
- [to clipboard](#to-clipboard)
|
- [to clipboard](#to-clipboard)
|
||||||
- [copy, move, delete files](#copy-move-delete-files)
|
|
||||||
- [cd on quit](#cd-on-quit)
|
- [cd on quit](#cd-on-quit)
|
||||||
- [run custom scripts](#run-custom-scripts)
|
- [run custom scripts](#run-custom-scripts)
|
||||||
- [sample scripts](#sample-scripts)
|
- [sample scripts](#sample-scripts)
|
||||||
|
@ -101,11 +100,12 @@ It runs on Linux, OS X, Raspberry Pi, Cygwin, Linux subsystem for Windows and Te
|
||||||
- Detailed stat-like file information
|
- Detailed stat-like file information
|
||||||
- Media information (needs mediainfo or exiftool, if specified)
|
- Media information (needs mediainfo or exiftool, if specified)
|
||||||
- Convenience
|
- Convenience
|
||||||
|
- Copy absolute file paths (optionally with quotes) in selection mode
|
||||||
|
- Copy, mode, delete multiple files by selection
|
||||||
- Create, rename files and directories
|
- Create, rename files and directories
|
||||||
- Batch rename/move/delete current directory entries in vidir (from moreutils)
|
- Batch rename/move/delete current directory entries in vidir (from moreutils)
|
||||||
- Spawn SHELL (fallback sh) in the current directory
|
- Spawn SHELL (fallback sh) in the current directory
|
||||||
- Run custom scripts in the current directory
|
- Run custom scripts in the current directory
|
||||||
- Copy absolute file paths with quotes
|
|
||||||
- Change directory at exit (*easy* shell integration)
|
- Change directory at exit (*easy* shell integration)
|
||||||
- Open any file in EDITOR (fallback vi) or PAGER (fallback less)
|
- Open any file in EDITOR (fallback vi) or PAGER (fallback less)
|
||||||
- GUI app launcher (maximum 2 space-separated arguments)
|
- GUI app launcher (maximum 2 space-separated arguments)
|
||||||
|
@ -206,7 +206,7 @@ optional args:
|
||||||
#### Keyboard shortcuts
|
#### Keyboard shortcuts
|
||||||
|
|
||||||
```
|
```
|
||||||
Key Function
|
Key Desc
|
||||||
----
|
----
|
||||||
↑, k, ^P Up
|
↑, k, ^P Up
|
||||||
↓, j, ^N Down
|
↓, j, ^N Down
|
||||||
|
@ -244,8 +244,12 @@ optional args:
|
||||||
F List archive
|
F List archive
|
||||||
^F Extract archive
|
^F Extract archive
|
||||||
Space, ^K Copy file path
|
Space, ^K Copy file path
|
||||||
^Y Toggle multi-copy
|
^Y Toggle selection mode
|
||||||
y Show copy buffer
|
y Show copy buffer
|
||||||
|
P Copy selection
|
||||||
|
V Move selection
|
||||||
|
^X Delete selection
|
||||||
|
X Delete entry
|
||||||
^T Toggle path quote
|
^T Toggle path quote
|
||||||
^L Redraw, clear prompt
|
^L Redraw, clear prompt
|
||||||
Esc Exit prompt
|
Esc Exit prompt
|
||||||
|
@ -371,16 +375,16 @@ Set environment variable `NNN_BMS` as a string of `key:location` pairs (max 10)
|
||||||
|
|
||||||
#### copy file paths
|
#### copy file paths
|
||||||
|
|
||||||
##### selection shortcuts
|
##### selection mode
|
||||||
|
|
||||||
Use <kbd>^K</kbd> to copy the absolute path (from `/`) of the file under the cursor to clipboard.
|
Use <kbd>^K</kbd> to copy the absolute path (from `/`) of the file under the cursor to clipboard.
|
||||||
|
|
||||||
To copy multiple file paths, switch to the multi-copy mode using <kbd>^Y</kbd>. In this mode you can
|
To copy multiple file paths the selection mode should be enabled using <kbd>^Y</kbd>. In this mode it's possible to
|
||||||
|
|
||||||
- cherry-pick individual files one by one by pressing <kbd>^K</kbd> on each entry; or,
|
- cherry-pick individual files one by one by pressing <kbd>^K</kbd> on each entry; or,
|
||||||
- navigate to another file in the same directory to select a range of files.
|
- navigate to another file in the same directory to select a range of files.
|
||||||
|
|
||||||
Pressing <kbd>^Y</kbd> again copies the paths to clipboard and exits the multi-copy mode.
|
Pressing <kbd>^Y</kbd> again copies the paths to clipboard and exits the selection mode. The files in the list can now be copied, moved or removed using respective keyboard shortcuts.
|
||||||
|
|
||||||
To list the file paths copied to memory press <kbd>y</kbd>.
|
To list the file paths copied to memory press <kbd>y</kbd>.
|
||||||
|
|
||||||
|
@ -393,7 +397,7 @@ Note that the filename is not escaped. So copying may still fail for filenames h
|
||||||
|
|
||||||
##### default copy
|
##### default copy
|
||||||
|
|
||||||
By default file paths are copied to the temporary file `DIR/.nnncp`, where `DIR` (by priority) is:
|
File paths are copied to the temporary file `DIR/.nnncp`, where `DIR` (by priority) is:
|
||||||
|
|
||||||
$HOME or,
|
$HOME or,
|
||||||
$TMPDIR or,
|
$TMPDIR or,
|
||||||
|
@ -433,7 +437,7 @@ Note that you may want to keep quotes disabled (as it is by default) in this cas
|
||||||
|
|
||||||
##### to clipboard
|
##### to clipboard
|
||||||
|
|
||||||
`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 OS X.
|
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 OS X.
|
||||||
|
|
||||||
Sample Linux copier script:
|
Sample Linux copier script:
|
||||||
|
|
||||||
|
@ -448,17 +452,6 @@ export `NNN_COPIER`:
|
||||||
|
|
||||||
export NNN_COPIER="/path/to/copier.sh"
|
export NNN_COPIER="/path/to/copier.sh"
|
||||||
|
|
||||||
#### copy, move, delete files
|
|
||||||
|
|
||||||
The `nnn` workflow to copy, move or delete files is:
|
|
||||||
|
|
||||||
1. Copy the absolute paths using <kbd>^Y</kbd> and/or <kbd>^K</kbd>
|
|
||||||
2. To copy or move files navigate to the destination directory. You can also fire a new instance of `nnn` in another tab of your terminal emulator and open the destination directory.
|
|
||||||
3. Spawn a subshell in the destination directory (<kbd>!</kbd>)
|
|
||||||
4. While typing the desired command, copy the file paths (usually <kbd>^-Shift-V</kbd>) from the clipboard. If X is unavailable, refer to [this section](#when-x-is-missing).
|
|
||||||
|
|
||||||
In addition, `nnn` integrates with vidir. vidir supports batch file move and delete.
|
|
||||||
|
|
||||||
#### cd on quit
|
#### cd on quit
|
||||||
|
|
||||||
To quit `nnn` and switch to the directory last opened follow the instructions below.
|
To quit `nnn` and switch to the directory last opened follow the instructions below.
|
||||||
|
|
18
nnn.1
18
nnn.1
|
@ -103,9 +103,18 @@ Extract archive in current directory
|
||||||
.It Ic Space, ^K
|
.It Ic Space, ^K
|
||||||
Invoke file path copier
|
Invoke file path copier
|
||||||
.It Ic ^Y
|
.It Ic ^Y
|
||||||
Toggle multiple file path copy mode
|
Toggle selection mode
|
||||||
.It Ic y
|
.It Ic y
|
||||||
Show copy buffer
|
Show copy buffer
|
||||||
|
.It Ic P
|
||||||
|
Copy files from selection
|
||||||
|
.It Ic V
|
||||||
|
Move files from selection
|
||||||
|
.It Ic ^X
|
||||||
|
Delete files from selection
|
||||||
|
.It Ic X
|
||||||
|
Delete the current entry
|
||||||
|
, ^Q Quit
|
||||||
.It Ic ^T
|
.It Ic ^T
|
||||||
Toggle path quote
|
Toggle path quote
|
||||||
.It Ic ^L
|
.It Ic ^L
|
||||||
|
@ -215,18 +224,19 @@ In the \fInavigate-as-you-type\fR mode directories are opened in filter mode,
|
||||||
allowing continuous navigation. Works best with the \fBarrow keys\fR.
|
allowing continuous navigation. Works best with the \fBarrow keys\fR.
|
||||||
.br
|
.br
|
||||||
In case of only one match and it's a directory, `nnn` auto selects the directory and enters it in this mode.
|
In case of only one match and it's a directory, `nnn` auto selects the directory and enters it in this mode.
|
||||||
.Sh MULTI-COPY MODE
|
.Sh SELECTION MODE
|
||||||
The absolute path of a single file can be copied to clipboard by pressing \fI^K\fR if
|
The absolute path of a single file can be copied to clipboard by pressing \fI^K\fR if
|
||||||
NNN_COPIER is set (see ENVIRONMENT section below).
|
NNN_COPIER is set (see ENVIRONMENT section below).
|
||||||
.Pp
|
.Pp
|
||||||
To copy multiple file paths the multi-copy mode should be enabled using \fI^Y\fR.
|
To copy multiple file paths the selection mode should be enabled using \fI^Y\fR.
|
||||||
In this mode it's possible to
|
In this mode it's possible to
|
||||||
.Pp
|
.Pp
|
||||||
(1) cherry-pick individual files one by one by pressing <kbd>^K</kbd> on each entry; or,
|
(1) cherry-pick individual files one by one by pressing <kbd>^K</kbd> on each entry; or,
|
||||||
.br
|
.br
|
||||||
(2) navigate to another file in the same directory to select a range of files.
|
(2) navigate to another file in the same directory to select a range of files.
|
||||||
.Pp
|
.Pp
|
||||||
Pressing \fI^Y\fR again copies the paths to clipboard and exits the multi-copy mode.
|
Pressing \fI^Y\fR again copies the paths and exits the selection mode. The files in the list can now
|
||||||
|
be copied, moved or removed using respective keyboard shortcuts.
|
||||||
.Pp
|
.Pp
|
||||||
To list the file paths copied to memory press \fIy\fR.
|
To list the file paths copied to memory press \fIy\fR.
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
|
|
14
src/nnn.c
14
src/nnn.c
|
@ -1998,8 +1998,12 @@ static int show_help(char *path)
|
||||||
"eF List archive\n"
|
"eF List archive\n"
|
||||||
"d^F Extract archive\n"
|
"d^F Extract archive\n"
|
||||||
"6Space, ^K Copy file path\n"
|
"6Space, ^K Copy file path\n"
|
||||||
"d^Y Toggle multi-copy\n"
|
"d^Y Toggle selection mode\n"
|
||||||
"ey Show copy buffer\n"
|
"ey Show copy buffer\n"
|
||||||
|
"eP Copy selection\n"
|
||||||
|
"eV Move selection\n"
|
||||||
|
"d^X Delete selection\n"
|
||||||
|
"eX Delete entry\n"
|
||||||
"d^T Toggle path quote\n"
|
"d^T Toggle path quote\n"
|
||||||
"d^L Redraw, clear prompt\n"
|
"d^L Redraw, clear prompt\n"
|
||||||
"cEsc Exit prompt\n"
|
"cEsc Exit prompt\n"
|
||||||
|
@ -2974,7 +2978,7 @@ nochange:
|
||||||
* This ensures that when the first file path is
|
* This ensures that when the first file path is
|
||||||
* copied into memory (but not written to tmp file
|
* copied into memory (but not written to tmp file
|
||||||
* yet to save on writes), the tmp file is cleared.
|
* yet to save on writes), the tmp file is cleared.
|
||||||
* The user may be in the middle of a multicopy op
|
* The user may be in the middle of selection mode op
|
||||||
* and issue a cp, mv of multi-rm assuming the files
|
* and issue a cp, mv of multi-rm assuming the files
|
||||||
* in the copy list would be affected. However, these
|
* in the copy list would be affected. However, these
|
||||||
* ops read the source file paths from the tmp file.
|
* ops read the source file paths from the tmp file.
|
||||||
|
@ -3029,7 +3033,7 @@ nochange:
|
||||||
copystartid = cur;
|
copystartid = cur;
|
||||||
copybufpos = 0;
|
copybufpos = 0;
|
||||||
ncp = 0;
|
ncp = 0;
|
||||||
printmsg("multi-copy on");
|
printmsg("selection on");
|
||||||
DPRINTF_S("copymode on");
|
DPRINTF_S("copymode on");
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
}
|
||||||
|
@ -3062,13 +3066,13 @@ nochange:
|
||||||
printmsg(newpath);
|
printmsg(newpath);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
printmsg("multi-copy off");
|
printmsg("selection off");
|
||||||
goto nochange;
|
goto nochange;
|
||||||
case SEL_COPYLIST:
|
case SEL_COPYLIST:
|
||||||
if (copybufpos)
|
if (copybufpos)
|
||||||
showcplist();
|
showcplist();
|
||||||
else
|
else
|
||||||
printmsg("multi-copy off");
|
printmsg("selection off");
|
||||||
goto nochange;
|
goto nochange;
|
||||||
case SEL_CP:
|
case SEL_CP:
|
||||||
case SEL_MV:
|
case SEL_MV:
|
||||||
|
|
Loading…
Reference in a new issue