diff --git a/.zshrc b/.zshrc index ed5964e..285195f 100644 --- a/.zshrc +++ b/.zshrc @@ -11,10 +11,11 @@ for S in \ 42-zinit \ 45-plugins \ 55-agents \ - 65-scripts \ - 75-aliases \ + 62-scripts \ + 68-aliases \ + 72-widgets \ + 78-keybindings \ 82-completion \ - 85-keybindings \ 88-prompt \ 95-finish do diff --git a/45-plugins.zsh b/45-plugins.zsh index ccac882..16f3e26 100644 --- a/45-plugins.zsh +++ b/45-plugins.zsh @@ -55,13 +55,9 @@ if command -v fzf > /dev/null 2>&1; then zinit snippet https://github.com/junegunn/fzf/blob/master/shell/completion.zsh zinit snippet https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh - zinit ice lucid wait'0' lucid - zinit light joshskidmore/zsh-fzf-history-search fi fi -zinit light zdharma-continuum/zsh-navigation-tools - if command -v git > /dev/null 2>&1; then GIT_AUTO_FETCH_INTERVAL=3600 zinit snippet OMZL::git.zsh diff --git a/65-scripts.zsh b/62-scripts.zsh similarity index 100% rename from 65-scripts.zsh rename to 62-scripts.zsh diff --git a/75-aliases.zsh b/68-aliases.zsh similarity index 100% rename from 75-aliases.zsh rename to 68-aliases.zsh diff --git a/72-widgets.zsh b/72-widgets.zsh new file mode 100644 index 0000000..3879c38 --- /dev/null +++ b/72-widgets.zsh @@ -0,0 +1,45 @@ +# shellcheck shell=bash +# vim: ft=sh + +# Navi +if command -v navi > /dev/null 2>&1; then + zinit snippet https://github.com/denisidoro/navi/blob/master/shell/navi.plugin.zsh + function magic-ctrl-g { + if ! (( $#BUFFER )) && [[ "$CONTEXT" == start ]]; then _navi_widget; fi + } + zle -N magic-ctrl-g + bindkey '^G' magic-ctrl-g +fi + +# FZF #{{{ +if command -v fzf > /dev/null 2>&1; then + function magic-ctrl-f { + if ! (( $#BUFFER )) && [[ "$CONTEXT" == start ]]; then fzf-file-widget; fi + } + zle -N magic-ctrl-f + bindkey '^F' magic-ctrl-f + + zinit ice wait'1' lucid light-mode depth'1' \ + atload"bindkey '^H' fzf-history; \ + bindkey '^Z' fzf-kill-proc-by-list" + zinit light amaya382/zsh-fzf-widgets + ZSH_FZF_PASTE_KEY=enter + ZSH_FZF_EXEC_KEY=ctrl-r +fi +#}}} + +zinit wait'1' lucid light-mode depth'1' for \ + atload"bindkey '^[[A' history-substring-search-up; \ + bindkey '^[[B' history-substring-search-down" \ + zsh-users/zsh-history-substring-search + +[ "$(lsb_release -c -s)" = "orel" ] && ZSH_HISTORY_SEARCH_MULTI_WORD_MODE=1 +[ -n "${SSH_CONNECTION}" ] && ZSH_HISTORY_SEARCH_MULTI_WORD_MODE=2 + +zstyle ':history-search-multi-word' page-size "$((LINES/2))" +zstyle ':plugin:history-search-multi-word' clear-on-cancel 'yes' +zinit ice \ + if'[[ -z ${ZSH_HISTORY_SEARCH_MULTI_WORD_MODE+set} ]]' \ + wait'1' lucid light-mode depth'1' \ + atload"bindkey '^K' history-search-multi-word" +zinit light zdharma-continuum/history-search-multi-word diff --git a/78-keybindings.zsh b/78-keybindings.zsh new file mode 100644 index 0000000..33451b4 --- /dev/null +++ b/78-keybindings.zsh @@ -0,0 +1,6 @@ +# shellcheck shell=bash +# vim: ft=sh + +# [Esc] [Esc] +bindkey '\e\e' send-break + diff --git a/82-completion.zsh b/82-completion.zsh index 6741024..5d95747 100644 --- a/82-completion.zsh +++ b/82-completion.zsh @@ -37,32 +37,3 @@ zinit wait'0' lucid light-mode depth'1' for \ atload"!_zsh_autosuggest_start" \ zsh-users/zsh-autosuggestions -zinit wait'1' lucid light-mode depth'1' for \ - atload"bindkey '^[[A' history-substring-search-up; \ - bindkey '^[[B' history-substring-search-down" \ - zsh-users/zsh-history-substring-search - -[ "$(lsb_release -c -s)" = "orel" ] && ZSH_HISTORY_SEARCH_MULTI_WORD_MODE=1 -[ -n "${SSH_CONNECTION}" ] && ZSH_HISTORY_SEARCH_MULTI_WORD_MODE=2 - -zstyle ':history-search-multi-word' page-size "$((LINES/2))" -zstyle ':plugin:history-search-multi-word' clear-on-cancel 'yes' -if [[ -z ${ZSH_HISTORY_SEARCH_MULTI_WORD_MODE+set} ]]; then - zinit wait'1' lucid light-mode depth'1' for \ - atload"bindkey '^K' history-search-multi-word" \ - zdharma-continuum/history-search-multi-word -#else -# function magic-ctrl-k { -# if ! (( $#BUFFER )) && [[ "$CONTEXT" == start ]]; then znt-history-widget; fi -# } -# zle -N magic-ctrl-k -# bindkey '^K' magic-ctrl-k -#elif [ ${ZSH_HISTORY_SEARCH_MULTI_WORD_MODE} = "1" ]; then -# zinit wait'2' lucid light-mode depth'1' for \ -# atload"bindkey '^K' history-search-multi-word" \ -# zdharma-continuum/history-search-multi-word -#elif [ ${ZSH_HISTORY_SEARCH_MULTI_WORD_MODE} = "2" ]; then -# zinit light zdharma-continuum/history-search-multi-word -# bindkey '^K' history-search-multi-word -fi - diff --git a/85-keybindings.zsh b/85-keybindings.zsh deleted file mode 100644 index 8f58913..0000000 --- a/85-keybindings.zsh +++ /dev/null @@ -1,33 +0,0 @@ -# shellcheck shell=bash -# vim: ft=sh - -# [Esc] [Esc] -bindkey '\e\e' send-break - -# Navi -if command -v navi > /dev/null 2>&1; then - zinit snippet https://github.com/denisidoro/navi/blob/master/shell/navi.plugin.zsh - function magic-ctrl-g { - if ! (( $#BUFFER )) && [[ "$CONTEXT" == start ]]; then _navi_widget; fi - } - zle -N magic-ctrl-g - bindkey '^G' magic-ctrl-g -fi - -# FZF #{{{ -function magic-ctrl-f { - if ! (( $#BUFFER )) && [[ "$CONTEXT" == start ]]; then fzf-file-widget; fi -} -zle -N magic-ctrl-f -bindkey '^F' magic-ctrl-f -bindkey "^[[A" fzf-history-widget # Up -bindkey "^[[B" fzf-history-widget # Down -bindkey "${terminfo[kcuu1]}" fzf-history-widget # Up -bindkey "${terminfo[kcud1]}" fzf-history-widget # Down -#}}} - -function magic-ctrl-z { - if ! (( $#BUFFER )) && [[ "$CONTEXT" == start ]]; then znt-kill-widget; fi -} -zle -N magic-ctrl-z -bindkey '^Z' magic-ctrl-z