diff --git a/82-completion.zsh b/82-completion.zsh index 112e90e..239b989 100644 --- a/82-completion.zsh +++ b/82-completion.zsh @@ -51,6 +51,12 @@ 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" \ diff --git a/85-keybindings.zsh b/85-keybindings.zsh index f7a6adb..8f58913 100644 --- a/85-keybindings.zsh +++ b/85-keybindings.zsh @@ -1,20 +1,33 @@ # shellcheck shell=bash # vim: ft=sh -# [Esc] [Esc] вместо Ctrl+G +# [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 - bindkey '^G' _navi_widget + function magic-ctrl-g { + if ! (( $#BUFFER )) && [[ "$CONTEXT" == start ]]; then _navi_widget; fi + } + zle -N magic-ctrl-g + bindkey '^G' magic-ctrl-g fi # FZF #{{{ -bindkey "^F" fzf-file-widget # Ctrl+F file search +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