Skip to content

Commit a9800ba

Browse files
committed
✨ feat: Add carapace zsh completion
1 parent a71b2a6 commit a9800ba

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

zsh/.zshrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ zinit light-mode lucid for OMZL::git.zsh # prompt functions
3333
zinit light-mode lucid for OMZL::history.zsh # history with time stamps
3434

3535
# Tools
36+
zinit snippet ${ZDOTDIR}/tools/carapace.zsh
3637
zinit snippet ${ZDOTDIR}/tools/direnv.zsh
3738
zinit snippet ${ZDOTDIR}/tools/mise.zsh
3839
zinit snippet ${ZDOTDIR}/tools/starship.zsh
@@ -68,6 +69,7 @@ zinit lucid wait for OMZP::thefuck # fuck function + ESC-ESC combo
6869
zinit snippet ${ZDOTDIR}/config/keybindings.zsh
6970

7071
# Completions
72+
zinit snippet ${ZDOTDIR}/completion/carapace.zsh # This should always be at the top
7173
zinit snippet ${ZDOTDIR}/completion/docker.zsh
7274
zinit snippet ${ZDOTDIR}/completion/kubectl.zsh
7375
zinit snippet ${ZDOTDIR}/completion/misc.zsh

zsh/completion/carapace.zsh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/zsh
2+
3+
zinit ice \
4+
as"completion" \
5+
id-as"carapace-completion" \
6+
atclone'carapace --list | awk '"'"'{print $1}'"'"' | while read -r cmd; do carapace "${cmd}" zsh > "_${cmd}"; done' \
7+
atpull"%atclone" \
8+
run-atpull \
9+
nocompile
10+
zinit light zdharma-continuum/null

zsh/tools/carapace.zsh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/zsh
2+
3+
zinit ice from"gh-r" \
4+
as"program" \
5+
mv"carapace* -> carapace" \
6+
pick"carapace" \
7+
atpull'carapace --selfupdate'
8+
zinit light carapace-sh/carapace-bin

0 commit comments

Comments
 (0)