changeset 676:128696498485

enable ctrl-w to erase parts of pathname in zsh
author zegervdv <zegervdv@me.com>
date Fri, 30 Sep 2022 07:32:55 +0000
parents 6c07661fbc1f
children 2dcf0ae65d5b
files dot_zshrc
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dot_zshrc	Fri Sep 30 07:28:28 2022 +0000
+++ b/dot_zshrc	Fri Sep 30 07:32:55 2022 +0000
@@ -281,6 +281,11 @@
                          --color=info:#4f9fcf,prompt:#d44950,pointer:#d71707 \
                          --color=marker:#d71707,spinner:#4f9fcf,header:#7653c1"
 
+unix-word-rubout() {
+  local WORDCHARS=$'!"#$%&\'()*+,-.:;<=>?@[\\]^_`{|}~'
+  zle backward-kill-word
+}
+
 # The plugin will auto execute this zvm_after_init function
 function zvm_after_init() {
   [ -f ~/.fzf.zsh  ] && source ~/.fzf.zsh
@@ -300,6 +305,9 @@
   bindkey '^n' history-substring-search-down
 
   bindkey '^f' autosuggest-accept
+
+  zle -N unix-word-rubout
+  bindkey '^w' unix-word-rubout
 }
 
 zsh-defer source ~/.zsh/zsh-vi-mode.zsh