feat(zsh): improve completion behaviour
This commit is contained in:
parent
f488f772ee
commit
cf138810e6
|
@ -27,9 +27,16 @@ in
|
|||
initExtraBeforeCompInit = with pkgs; ''
|
||||
source ${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
source ${zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
source ${./first-tab-completion.zsh}
|
||||
'';
|
||||
initExtra = ''
|
||||
zmodload zsh/complist
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*' insert-tab false
|
||||
bindkey '^I' first-tab-completion
|
||||
bindkey -M menuselect '\e' send-break
|
||||
bindkey -M menuselect '^[[Z' reverse-menu-complete
|
||||
|
||||
setopt histignoredups
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
|
|
11
home/shell/first-tab-completion.zsh
Normal file
11
home/shell/first-tab-completion.zsh
Normal file
|
@ -0,0 +1,11 @@
|
|||
first-tab-completion() {
|
||||
if [[ $#BUFFER == 0 ]]; then
|
||||
BUFFER="cd "
|
||||
CURSOR=3
|
||||
zle list-choices
|
||||
# zle backward-kill-word # breaks completion
|
||||
else
|
||||
zle expand-or-complete
|
||||
fi
|
||||
}
|
||||
zle -N first-tab-completion
|
Loading…
Reference in a new issue