From dd91f10bb4294e35f0aebab285a03f983c4a4f9f Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 22 Dec 2022 21:58:01 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BF=D1=83=D1=81=D0=BA=20=D0=B2?= =?UTF-8?q?=D0=B8=D0=B4=D0=B6=D0=B5=D1=82=D0=BE=D0=B2,=20=D0=B5=D1=81?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0=20=D0=BF=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 82-completion.zsh | 6 ++++++ 85-keybindings.zsh | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) 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