diff --git a/.gitmodules b/.gitmodules index eed3d0c..0b4127a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "zsh/custom/plugins/zsh-completions"] path = zsh/custom/plugins/zsh-completions url = https://github.com/zsh-users/zsh-completions.git +[submodule "zsh/custom/plugins/zsh-vi-mode"] + path = zsh/custom/plugins/zsh-vi-mode + url = https://github.com/jeffreytse/zsh-vi-mode diff --git a/zsh/.stow-local-ignore b/zsh/.stow-local-ignore index 904e36b..1fd7d3b 100644 --- a/zsh/.stow-local-ignore +++ b/zsh/.stow-local-ignore @@ -1,2 +1,3 @@ ohmyzsh custom +fzf-git.sh diff --git a/zsh/custom/plugins/zsh-vi-mode b/zsh/custom/plugins/zsh-vi-mode new file mode 160000 index 0000000..08bd1c0 --- /dev/null +++ b/zsh/custom/plugins/zsh-vi-mode @@ -0,0 +1 @@ +Subproject commit 08bd1c04520418faee2b9d1afbc410ee1a59a8f1 diff --git a/zsh/dot-zshrc b/zsh/dot-zshrc index 3c22505..e58ba2b 100644 --- a/zsh/dot-zshrc +++ b/zsh/dot-zshrc @@ -21,7 +21,7 @@ plugins=( zsh-autosuggestions # Disabled because the highlighting conflicts with autosuggestions # history-substring-search - vi-mode + zsh-vi-mode colored-man-pages command-not-found zsh-autopair @@ -37,8 +37,21 @@ HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT=3 ZSH_AUTOSUGGEST_STRATEGY=(history completion) -VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true -VI_MODE_SET_CURSOR=true +# Enable system clipboard +ZVM_SYSTEM_CLIPBOARD_ENABLED=true +# Make p and P use the system clipboard, instead of CUTBUFFER, +# without this you need gp and gP +function zvm_after_lazy_keybindings() { + bindkey -M vicmd 'p' zvm_paste_clipboard_after + bindkey -M vicmd 'P' zvm_paste_clipboard_before + bindkey -M visual 'p' zvm_visual_paste_clipboard + bindkey -M visual 'P' zvm_visual_paste_clipboard +} + +# Fix autopair and zsh-vi-mode compatibility +AUTOPAIR_INHIBIT_INIT=1 +zvm_after_init_commands+=('autopair-init') + # Might cause issues? KEYTIMEOUT=1 @@ -113,6 +126,7 @@ if (( $+commands[fd] )); then fi if (( $+commands[fzf] )); then source <(fzf --zsh) + zvm_after_init_commands+=('source <(fzf --zsh)') if (( $+commands[paru] )); then function pi { @@ -121,25 +135,6 @@ if (( $+commands[fzf] )); then fi fi -export _ZO_FZF_OPTS="--tmux" -if (( $+commands[zoxide] )); then - eval "$(zoxide init zsh --cmd cd)" -fi - -# Generate missing text objects -autoload -Uz select-bracketed select-quoted -zle -N select-quoted -zle -N select-bracketed -for km in viopp visual; do - bindkey -M $km -- '-' vi-up-line-or-history - for c in {a,i}${(s..)^:-\'\"\`\|,./:;=+@}; do - bindkey -M $km $c select-quoted - done - for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do - bindkey -M $km $c select-bracketed - done -done - ZSH_TMUX_AUTOSTART=true if (( $+commands[tmux] )); then if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" && -z "$ZED_TERM" ]]; then