commit 899165c094dc7acbbe163936955742f16a80cd53 parent cd804108af9ba16de7f0b84cb54106ec63c2e319 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Wed, 31 Jul 2019 16:58:03 +0200 zsh: add bash-like key bindings Former-commit-id: d14c29fc162b4f50a1ea0f8b6d2bf23dcfa3b9b3 Diffstat:
M | shell/zshrc | | | 18 | ++++++++++++++++++ |
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/shell/zshrc b/shell/zshrc @@ -127,3 +127,21 @@ fi [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" + +insert-arg-of-prev-cmd() { +: ${NUMERIC:-1} +(( NUMERIC++ )) +words=($(fc -ln -1)) +RBUFFER+="$words[$NUMERIC] " +zle end-of-line +} + +zle -N insert-arg-of-prev-cmd +bindkey "\e^y" insert-arg-of-prev-cmd + +# readline-style line commenting +bindkey '\e#' pound-insert + +# readline-style searching +bindkey '^]' vi-find-next-char +bindkey '^\e]' vi-find-prev-char