README.md | 5 +++++
nnn.c | 22 ++++++++++++++++++++++
diff --git a/README.md b/README.md
index d2e57f484dc1a7ad63526927e1f14af2a431346d..a04d2098ebdc5426d7d082ee49a6d1fb17bbbb9f 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,7 @@ - [run a custom script](#run-a-custom-script)
- [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)
@@ -439,6 +440,10 @@
#### boost chdir prompt
`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 - ^A, ^E, ^U. ^L clears the name.
#### set idle timeout
diff --git a/nnn.c b/nnn.c
index 0e630818578ccc5cf47e91d18aa5d25c57e417ef..9d668ed90dedc61f0d5d1fdba684cbbb8865c350 100644
--- a/nnn.c
+++ b/nnn.c
@@ -1235,6 +1235,28 @@ len = pos = 0;
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;