aboutsummaryrefslogtreecommitdiffstats
path: root/nnn.h
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-01-14 01:43:30 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-01-14 01:43:30 +0530
commita40d29ba9f5673523dfdf28e17d448a3cb8da1f8 (patch)
tree4e4878b05aab4658c1aa0a1904ae281a67ec8772 /nnn.h
parent48002508141f7b84b7fb5a881e7deb3c03fc4d3b (diff)
downloadnnn-a40d29ba9f5673523dfdf28e17d448a3cb8da1f8.tar.gz
Support multiple file path copy
Design overview: We are introducing multiple file path copy as a mode which can be toggled using the keybind `^Y`. `^K` works as the individual entry selector. If the user wants to select a range, (s)he can press `^Y` on the first entry and `^Y` on the last entry. We subscribe to notifications, so we need a fail-proof way to detect changes in the directory contents. For example, if a file is deleted, it becomes difficult to get the names of all the files in a range containing that file. If the file is on a range boundary it would lead to wrong calculations. To handle this the right way we use CRC8 checksum of all the visible entries in the directory. The checksum is calculated based on the file information buffer. If the CRC changes on a redraw(), we reset the multi-select mode. New line (`\n`) works as the delimiter between file paths. Note that you may have to disable IFS in the `NNN_COPIER` script to show file paths separated by spaces.
Diffstat (limited to 'nnn.h')
-rw-r--r--nnn.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/nnn.h b/nnn.h
index 9582420..4027c25 100644
--- a/nnn.h
+++ b/nnn.h
@@ -34,6 +34,7 @@ enum action {
SEL_MTIME,
SEL_REDRAW,
SEL_COPY,
+ SEL_COPYMUL,
SEL_OPEN,
SEL_NEW,
SEL_RENAME,
@@ -145,6 +146,8 @@ static struct key bindings[] = {
{ KEY_F(5), SEL_REDRAW, "", "" }, /* Undocumented */
/* Copy currently selected file path */
{ CONTROL('K'), SEL_COPY, "", "" },
+ /* Toggle copy multiple file paths */
+ { CONTROL('Y'), SEL_COPYMUL, "", "" },
/* Open in a custom application */
{ CONTROL('O'), SEL_OPEN, "", "" },
/* Create a new file */