mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Support ^A, ^E, ^U and ignore ^ chars at rename prompt
This commit is contained in:
parent
0e623010e6
commit
bfb814bca6
|
@ -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`.
|
||||
|
|
22
nnn.c
22
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;
|
||||
|
|
Loading…
Reference in a new issue