Запуск виджетов, если командная строка пуста

This commit is contained in:
Andrei Astafev 2022-12-22 21:58:01 +03:00
parent 0943137da8
commit dd91f10bb4
2 changed files with 22 additions and 3 deletions

View File

@ -51,6 +51,12 @@ if [[ -z ${ZSH_HISTORY_SEARCH_MULTI_WORD_MODE+set} ]]; then
zinit wait'1' lucid light-mode depth'1' for \ zinit wait'1' lucid light-mode depth'1' for \
atload"bindkey '^K' history-search-multi-word" \ atload"bindkey '^K' history-search-multi-word" \
zdharma-continuum/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 #elif [ ${ZSH_HISTORY_SEARCH_MULTI_WORD_MODE} = "1" ]; then
# zinit wait'2' lucid light-mode depth'1' for \ # zinit wait'2' lucid light-mode depth'1' for \
# atload"bindkey '^K' history-search-multi-word" \ # atload"bindkey '^K' history-search-multi-word" \

View File

@ -1,20 +1,33 @@
# shellcheck shell=bash # shellcheck shell=bash
# vim: ft=sh # vim: ft=sh
# [Esc] [Esc] вместо Ctrl+G # [Esc] [Esc]
bindkey '\e\e' send-break bindkey '\e\e' send-break
# Navi # Navi
if command -v navi > /dev/null 2>&1; then if command -v navi > /dev/null 2>&1; then
zinit snippet https://github.com/denisidoro/navi/blob/master/shell/navi.plugin.zsh 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 fi
# FZF #{{{ # 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 "^[[A" fzf-history-widget # Up
bindkey "^[[B" fzf-history-widget # Down bindkey "^[[B" fzf-history-widget # Down
bindkey "${terminfo[kcuu1]}" fzf-history-widget # Up bindkey "${terminfo[kcuu1]}" fzf-history-widget # Up
bindkey "${terminfo[kcud1]}" fzf-history-widget # Down 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