1
0
Fork 0

Add additional downloadable completions

main
Ambrose Chua 2023-02-10 10:18:13 +08:00
parent 6304f8507d
commit 8f4e94bc3e
4 changed files with 39 additions and 10 deletions

View File

@ -0,0 +1,19 @@
#!/bin/sh
set -eu
wget \
--output-document zsh-completions.tar.gz \
https://github.com/zsh-users/zsh-completions/archive/refs/heads/master.tar.gz
tar -xzf zsh-completions.tar.gz \
--strip-components=2 \
zsh-completions-master/src
rm zsh-completions.tar.gz
wget \
--output-document _docker \
https://github.com/docker/cli/raw/master/contrib/completion/zsh/_docker
wget \
--output-document _docker-compose \
https://github.com/greymd/docker-zsh-completion/raw/master/repos/docker/compose/master/contrib/completion/zsh/_docker-compose

View File

@ -44,6 +44,9 @@
!.config/wofi
!.config/yabai
!.config/yadm
!.config/zsh-completions
.config/zsh-completions/*
!.config/zsh-completions/download.sh
.deno/bin
.docker/.buildNodeID
.docker/.token_seed*
@ -119,6 +122,7 @@
!.xkb
.zcompdump
.zoom
.zshrc-theme
!.zshrc

4
.gitignore vendored
View File

@ -44,6 +44,9 @@
!.config/wofi
!.config/yabai
!.config/yadm
!.config/zsh-completions
.config/zsh-completions/*
!.config/zsh-completions/download.sh
.deno/bin
.docker/.buildNodeID
.docker/.token_seed*
@ -119,4 +122,5 @@
!.xkb
.zcompdump
.zoom
.zshrc-theme
!.zshrc

22
.zshrc
View File

@ -46,10 +46,10 @@ sup() {
prompt_run_count=0
on_second_prompt() {
if [[ "$prompt_run_count" == 1 ]] && [[ "$USER" != "root" ]]; then
#zmodload zsh/zprof
zmodload zsh/zprof
load_slower
load_slowest
#zprof
zprof
fi
(( prompt_run_count = prompt_run_count + 1 ))
}
@ -187,7 +187,6 @@ if [[ "$TERM" == "xterm-kitty" ]] && which kitty 2>&1 >/dev/null; then
alias ssh="kitty +kitten ssh"
fi
setup_term_integration
#slower_functions+=( setup_term_integration )
# term fixes
@ -209,6 +208,9 @@ setup_completion() {
autoload -Uz bashcompinit
bashcompinit
fi
# Add default completions
fpath+="$HOME/.config/zsh-completions"
# Style completions
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
@ -224,18 +226,19 @@ setup_completion() {
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
}
slower_functions+=( setup_completion )
setup_completion_more() {
# Depends:
setup_completion
# Setup fast apps
if which mc 2>&1 >/dev/null; then
complete -o nospace -C mc mc
fi
if which earthly 2>&1 >/dev/null; then
complete -o nospace -C earthly earthly
fi
}
slower_functions+=( setup_completion )
setup_completion_more() {
# Depends:
setup_completion
if which kubectl 2>&1 >/dev/null; then
source <(kubectl completion zsh)
fi
@ -243,7 +246,6 @@ setup_completion_more() {
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
fi
}
#slower_functions+=( setup_completion_more )
slowest_functions+=( setup_completion_more )
# color pagination