diff options
author | johannst <johannes.stoelp@gmail.com> | 2021-01-06 23:38:23 +0100 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2021-01-06 23:38:23 +0100 |
commit | 56183a201950625ad80ddaeefe70e47d0f1a900c (patch) | |
tree | 89edc8b6ac6356176e217e225a462157be1c5f6d /zshrc | |
parent | 8c64543e3366413f2d830bf263ff0dfbd8482146 (diff) | |
download | dotfiles-56183a201950625ad80ddaeefe70e47d0f1a900c.tar.gz dotfiles-56183a201950625ad80ddaeefe70e47d0f1a900c.zip |
zshrc add kill function to only delete parts of paths
Diffstat (limited to 'zshrc')
-rw-r--r-- | zshrc | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -143,10 +143,22 @@ bindkey -- "$key[Down]" down-line-or-beginning-search # Emacs mode +# Backward delete word without treating '/' as part of a word. Convenient when deleting paths. +function emacs-backward-kill-word() { + # WORDCHARS + # A list of non-alphanumeric characters considered part of a word by the line editor. + + # Remove '/' from WORDCHARS + local WORDCHARS=${WORDCHARS/\//} + zle backward-kill-word +} +zle -N emacs-backward-kill-word + +bindkey -M emacs "$key[CtrlLeft]" backward-word bindkey -M emacs "$key[AltLeft]" backward-word bindkey -M emacs "$key[CtrlRight]" forward-word bindkey -M emacs "$key[AltRight]" forward-word -bindkey -M emacs "$key[CtrlBackspace]" backward-kill-word +bindkey -M emacs "$key[CtrlBackspace]" emacs-backward-kill-word # Vi mode @@ -168,6 +180,7 @@ bindkey -M viins "$key[CtrlS]" history-incremental-search-forward bindkey -M viins "$key[CtrlW]" backward-kill-word bindkey -M viins "$key[Backspace]" backward-delete-char +bindkey -M viins "$key[CtrlBackspace]" emacs-backward-kill-word # Dirstack |