diff --git a/README.md b/README.md index b665f90..90dcb2e 100644 --- a/README.md +++ b/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) - [add bookmarks](#add-bookmarks) - [copy file paths](#copy-file-paths) - - [selection shortcuts](#selection-shortcuts) + - [selection mode](#selection-mode) - [default copy](#default-copy) - [to clipboard](#to-clipboard) - - [copy, move, delete files](#copy-move-delete-files) - [cd on quit](#cd-on-quit) - [run custom scripts](#run-custom-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 - Media information (needs mediainfo or exiftool, if specified) - Convenience + - Copy absolute file paths (optionally with quotes) in selection mode + - Copy, mode, delete multiple files by selection - Create, rename files and directories - Batch rename/move/delete current directory entries in vidir (from moreutils) - Spawn SHELL (fallback sh) in the current directory - Run custom scripts in the current directory - - Copy absolute file paths with quotes - Change directory at exit (*easy* shell integration) - Open any file in EDITOR (fallback vi) or PAGER (fallback less) - GUI app launcher (maximum 2 space-separated arguments) @@ -206,7 +206,7 @@ optional args: #### Keyboard shortcuts ``` - Key Function + Key Desc ---- ↑, k, ^P Up ↓, j, ^N Down @@ -244,8 +244,12 @@ optional args: F List archive ^F Extract archive Space, ^K Copy file path - ^Y Toggle multi-copy + ^Y Toggle selection mode y Show copy buffer + P Copy selection + V Move selection + ^X Delete selection + X Delete entry ^T Toggle path quote ^L Redraw, clear 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 -##### selection shortcuts +##### selection mode Use ^K 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 ^Y. In this mode you can +To copy multiple file paths the selection mode should be enabled using ^Y. In this mode it's possible to - cherry-pick individual files one by one by pressing ^K on each entry; or, - navigate to another file in the same directory to select a range of files. -Pressing ^Y again copies the paths to clipboard and exits the multi-copy mode. +Pressing ^Y 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 y. @@ -393,7 +397,7 @@ Note that the filename is not escaped. So copying may still fail for filenames h ##### 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, $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 -`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: @@ -448,17 +452,6 @@ export `NNN_COPIER`: 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 ^Y and/or ^K -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 (!) -4. While typing the desired command, copy the file paths (usually ^-Shift-V) 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 To quit `nnn` and switch to the directory last opened follow the instructions below. diff --git a/nnn.1 b/nnn.1 index b8c159c..cacd07c 100644 --- a/nnn.1 +++ b/nnn.1 @@ -103,9 +103,18 @@ Extract archive in current directory .It Ic Space, ^K Invoke file path copier .It Ic ^Y -Toggle multiple file path copy mode +Toggle selection mode .It Ic y 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 Toggle path quote .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. .br 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 NNN_COPIER is set (see ENVIRONMENT section below). .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 .Pp (1) cherry-pick individual files one by one by pressing ^K on each entry; or, .br (2) navigate to another file in the same directory to select a range of files. .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 To list the file paths copied to memory press \fIy\fR. .Sh ENVIRONMENT diff --git a/src/nnn.c b/src/nnn.c index 8feb610..89d6d99 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -1998,8 +1998,12 @@ static int show_help(char *path) "eF List archive\n" "d^F Extract archive\n" "6Space, ^K Copy file path\n" - "d^Y Toggle multi-copy\n" + "d^Y Toggle selection mode\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^L Redraw, clear prompt\n" "cEsc Exit prompt\n" @@ -2974,7 +2978,7 @@ nochange: * This ensures that when the first file path is * copied into memory (but not written to tmp file * 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 * in the copy list would be affected. However, these * ops read the source file paths from the tmp file. @@ -3029,7 +3033,7 @@ nochange: copystartid = cur; copybufpos = 0; ncp = 0; - printmsg("multi-copy on"); + printmsg("selection on"); DPRINTF_S("copymode on"); goto nochange; } @@ -3062,13 +3066,13 @@ nochange: printmsg(newpath); } } else - printmsg("multi-copy off"); + printmsg("selection off"); goto nochange; case SEL_COPYLIST: if (copybufpos) showcplist(); else - printmsg("multi-copy off"); + printmsg("selection off"); goto nochange; case SEL_CP: case SEL_MV: