Last active
April 8, 2021 20:02
-
-
Save relrod/c0008c042d411ac674ab7a9c69b61278 to your computer and use it in GitHub Desktop.
Restore some bash/readline-isms in ZSH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autoload -Uz compinit && compinit | |
setopt nonomatch | |
setopt interactivecomments | |
function unfuck-zsh-kb { | |
local WORDCHARS="${WORDCHARS//[\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\{\}\[\]\|\\\:\;\"\'\<\,\>\.\?\/]/}" | |
fn="$1" | |
shift | |
zle $fn "$@" | |
} | |
# Make M-BS work again | |
function backward-kill-partial-word { unfuck-zsh-kb backward-kill-word; } | |
zle -N backward-kill-partial-word | |
for x in '^Xw' '^[^?' '^[^H'; do | |
bindkey "$x" backward-kill-partial-word | |
done; unset x | |
# Make M-b work again | |
function backward-partial-word { unfuck-zsh-kb backward-word; } | |
zle -N backward-partial-word | |
bindkey '^[b' backward-partial-word | |
# Make M-f work again | |
function forward-partial-word { unfuck-zsh-kb forward-word; } | |
zle -N forward-partial-word | |
bindkey '^[f' forward-partial-word | |
# Make M-d work again | |
function forward-partial-kill-word { unfuck-zsh-kb kill-word; } | |
zle -N forward-partial-kill-word | |
bindkey '^[d' forward-partial-kill-word | |
# Make M-# work again | |
bindkey '\e#' pound-insert | |
# This is a damned lie, it doesn't fucking work. | |
#autoload -U select-word-style | |
#select-word-style bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment