diff options
author | Marc Cornellà <marc.cornella@live.com> | 2020-08-04 17:13:22 +0200 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2020-08-04 17:16:54 +0200 |
commit | e04564d52880b39032ca6a1841a48138db185aec (patch) | |
tree | eea97afc39786d093d0a21e79be800cfbf62933b /lib/key-bindings.zsh | |
parent | ec70c0c393e53004b885d146dd77b9a3f136971a (diff) | |
download | zsh-e04564d52880b39032ca6a1841a48138db185aec.tar.gz zsh-e04564d52880b39032ca6a1841a48138db185aec.tar.bz2 zsh-e04564d52880b39032ca6a1841a48138db185aec.zip |
lib: add CTRL-backspace and CTRL-delete to delete whole words
Fixes #7609
Closes #8191
Co-authored-by: Michal Grňo <m93a.cz@gmail.com>
Diffstat (limited to 'lib/key-bindings.zsh')
-rw-r--r-- | lib/key-bindings.zsh | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 10053f6f3..ac1adf2e7 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -71,17 +71,33 @@ if [[ -n "${terminfo[kcbt]}" ]]; then fi # [Backspace] - delete backward -bindkey '^?' backward-delete-char +bindkey -M emacs '^?' backward-delete-char +bindkey -M viins '^?' backward-delete-char +bindkey -M vicmd '^?' backward-delete-char # [Delete] - delete forward if [[ -n "${terminfo[kdch1]}" ]]; then bindkey -M emacs "${terminfo[kdch1]}" delete-char bindkey -M viins "${terminfo[kdch1]}" delete-char # [Delete] - delete forward bindkey -M vicmd "${terminfo[kdch1]}" delete-char # [Delete] - delete forward else - bindkey "^[[3~" delete-char - bindkey "^[3;5~" delete-char + bindkey -M emacs "^[[3~" delete-char + bindkey -M viins "^[[3~" delete-char + bindkey -M vicmd "^[[3~" delete-char + + bindkey -M emacs "^[3;5~" delete-char + bindkey -M viins "^[3;5~" delete-char + bindkey -M vicmd "^[3;5~" delete-char fi +# [Ctrl-Backspace] - delete whole backward-word +bindkey -M emacs '^H' backward-kill-word +bindkey -M viins '^H' backward-kill-word +bindkey -M vicmd '^H' backward-kill-word +# [Ctrl-Delete] - delete whole forward-word +bindkey -M emacs '^[[3;5~' kill-word +bindkey -M viins '^[[3;5~' kill-word +bindkey -M vicmd '^[[3;5~' kill-word + # [Ctrl-RightArrow] - move forward one word bindkey -M emacs '^[[1;5C' forward-word bindkey -M viins '^[[1;5C' forward-word @@ -91,11 +107,13 @@ bindkey -M emacs '^[[1;5D' backward-word bindkey -M viins '^[[1;5D' backward-word bindkey -M vicmd '^[[1;5D' backward-word + bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. bindkey ' ' magic-space # [Space] - don't do history expansion + # Edit the current command line in $EDITOR autoload -U edit-command-line zle -N edit-command-line |