Skip to content

Commit

Permalink
use flag for "dd"/"cc"/"yy" behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
xPMo committed Jun 24, 2020
1 parent 012da10 commit a2357a9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 8 additions & 1 deletion functions/-viopp-wrapper
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
if [[ -v __zvmm_viopp_wrapper ]]; then
# if inside vi-delete|change|yank, it needs to read-command itself
zle ${WIDGET#zvmm-}
return
fi
local key
read -k 1 key
if [[ $key = 's' ]]; then
Expand All @@ -7,8 +12,10 @@ if [[ $key = 's' ]]; then
vi-yank*) zle add-surround ;;
esac
else
typeset -g __zvmm_viopp_wrapper
zle -U $key
zle .${WIDGET%-wrapper}
zle ${WIDGET#zvmm-} -w
unset __zvmm_viopp_wrapper
fi

# vim: syntax=zsh
12 changes: 7 additions & 5 deletions motions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ for m in vicmd viopp; do
done
done
zle -N vi-change-wrapper -viopp-wrapper
zle -N vi-delete-wrapper -viopp-wrapper
zle -N vi-yank-wrapper -viopp-wrapper
# Load Vi-surround from zsh/functions/Zle
zle -N delete-surround surround
zle -N add-surround surround
zle -N change-surround surround
bindkey -M vicmd c vi-change-wrapper d vi-delete-wrapper y vi-yank-wrapper
zle -N zvmm-vi-change -viopp-wrapper
zle -N zvmm-vi-delete -viopp-wrapper
zle -N zvmm-vi-yank -viopp-wrapper
bindkey -M vicmd c zvmm-vi-change d zvmm-vi-delete y zvmm-vi-yank
bindkey -M visual S add-surround
# Add forward/backwards widgets
Expand Down

0 comments on commit a2357a9

Please sign in to comment.