diff options
author | Josh Rahm <rahm@google.com> | 2025-01-30 22:02:28 +0000 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2025-01-30 22:02:28 +0000 |
commit | 95380088436ba5a4ae9b4cf9a11070a96246bc0c (patch) | |
tree | 209459f0635cd9303fbd74d4fcc65f74e33bbe54 /98-bindkeys.zsh | |
parent | 89a6513ed79b86fa7041c0e18299c1d7bf6a4be3 (diff) | |
download | zshrcd-main.tar.gz zshrcd-main.tar.bz2 zshrcd-main.zip |
Diffstat (limited to '98-bindkeys.zsh')
-rw-r--r-- | 98-bindkeys.zsh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/98-bindkeys.zsh b/98-bindkeys.zsh index 1c20068..f3bb40f 100644 --- a/98-bindkeys.zsh +++ b/98-bindkeys.zsh @@ -1,5 +1,16 @@ bindkey -v +insert-last-word() { + # Trim trailing whitespace from LBUFFER + local trimmed="${LBUFFER%"${LBUFFER##*[![:space:]]}"}" + + # Extract the last space-separated word + local last_word="${trimmed##* }" + LBUFFER+="$last_word" +} + +zle -N insert-last-word + bindkey -M menuselect 'h' vi-backward-char bindkey -M menuselect 'k' vi-up-line-or-history bindkey -M menuselect 'l' vi-forward-char @@ -16,6 +27,8 @@ autoload edit-command-line zle -N edit-command-line bindkey '' edit-command-line +bindkey '' insert-last-word + # This allows a ctrl-w motion with neovim, so one does not have do a terminal # escape to switch panes. nvim-move-pane() { @@ -130,4 +143,5 @@ bindkey -M vicmd '@' select-nvim-reg bindkey -M vicmd 'p' put-after-reg-override bindkey -M viins '' nvim-complete +bindkey -M viins '' vi-forward-char |