aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--nnn.c22
2 files changed, 27 insertions, 0 deletions
diff --git a/README.md b/README.md
index d2e57f4..a04d209 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,7 @@ Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/i
- [change dir color](#change-dir-color)
- [file copy, move, delete](#file-copy-move-delete)
- [boost chdir prompt](#boost-chdir-prompt)
+ - [work faster at rename prompt](#work-faster-at-rename-prompt)
- [set idle timeout](#set-idle-timeout)
- [show hot plugged drives](#show-hot-plugged-drives)
- [Why fork?](#why-fork)
@@ -440,6 +441,10 @@ In addition, nnn integrates with vidir. vidir supports batch file move and delet
`nnn` uses libreadline for the chdir prompt input. So all the fantastic features of readline (e.g. case insensitive tab completion, history, reverse-i-search) are available to you based on your readline [configuration](https://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC9).
+#### work faster at rename prompt
+
+The rename prompt supports some bash-like command-line shortcuts - <kbd>^A</kbd>, <kbd>^E</kbd>, <kbd>^U</kbd>. <kbd>^L</kbd> clears the name.
+
#### set idle timeout
The terminal screensaver is disabled by default. To set the wait time in seconds, use environment variable `NNN_IDLE_TIMEOUT`.
diff --git a/nnn.c b/nnn.c
index 0e63081..9d668ed 100644
--- a/nnn.c
+++ b/nnn.c
@@ -1235,6 +1235,28 @@ xreadline(char *fname)
continue;
}
+ if (*ch == CONTROL('A')) {
+ pos = 0;
+ continue;
+ }
+
+ if (*ch == CONTROL('E')) {
+ pos = len;
+ continue;
+ }
+
+ if (*ch == CONTROL('U')) {
+ clearprompt();
+ memmove(buf, buf + pos, (len - pos) << 2);
+ len -= pos;
+ pos = 0;
+ continue;
+ }
+
+ /* Filter out all other control chars */
+ if (keyname(*ch)[0] == '^')
+ continue;
+
/* TAB breaks cursor position, ignore it */
if (*ch == '\t')
continue;