- Ctrl-W delete WORD but not only separated by whitespaces but punctuation like
_, -
- “Ctrl Shift -” didn’t undo
- history was mixed by default (when multi-sessions were opened, all of their history will be added instead of only the first one session’s)
# Keep interactive editing close to Bash's emacs/readline behavior.
# Keep zsh's original punctuation-boundary behavior for Option-Delete.
WORDCHARS=''
# Bash Ctrl-W uses whitespace-only word boundaries. Reuse zsh's built-in
# widget with a temporary punctuation-inclusive WORDCHARS value.
function bash-unix-word-rubout() {
local old_wordchars=$WORDCHARS
WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>'
zle backward-kill-word
WORDCHARS=$old_wordchars
}
zle -N bash-unix-word-rubout
bindkey -M emacs '^W' bash-unix-word-rubout
bindkey -M emacs '^[^?' backward-kill-word # Alt-Del (Option-Delete)
bindkey -M emacs '^_' undo
bindkey -M emacs '^X^U' undo
# Bash does not merge commands from concurrently running shells into the
# current history list. Append each shell's commands when it exits instead
# of importing other shells' commands as they are entered.
unsetopt share_history
setopt append_history