ADD conda completion

This commit is contained in:
Nathan Dwarshuis 2024-02-23 19:22:15 -05:00
parent c27388d363
commit 51d20595fa
3 changed files with 22 additions and 2 deletions

View File

@ -23,3 +23,8 @@
type: git-repo
url: https://github.com/zsh-users/zsh-syntax-highlighting.git
clone.args: --branch 0.7.1
{{- if .development.conda }}
.local/share/zsh/completion/zsh-conda-completion:
type: git-repo
url: https://github.com/conda-incubator/conda-zsh-completion.git
{{- end }}

View File

@ -4,8 +4,9 @@ channels:
channel_priority: strict
envs_dirs:
- {{ .paths.data }}/conda/envs
# define this in zshrc so the completion engine can find my local envs
#envs_dirs:
# - {{ .paths.data }}/conda/envs
pkgs_dirs:
- {{ .paths.data }}/conda/pkgs

View File

@ -42,6 +42,11 @@ alias_if_sudo () {
# autocompletion
## --------------------------------------------------
{{ if .development.conda -}}
# add conda completions to path if desired
fpath+="$XDG_DATA_HOME/zsh/completion/zsh-conda-completion"
{{- end }}
# load stuff (order matters)
zmodload zsh/complist
autoload -Uz compinit && compinit -i
@ -64,6 +69,12 @@ zstyle ':completion:*:*:*:*:descriptions' format '%F{green}-- %d --%f'
zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f'
zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'
{{ if .development.conda -}}
# show group headers for conda completion
zstyle ":conda_zsh_completion:*" use-groups true
zstyle ':completion::complete:*' use-cache 1
{{- end }}
# use sane grouping
zstyle ':completion:*' group-name ''
@ -469,5 +480,8 @@ zsh-conda () {
alias cda="conda activate"
alias cde="conda env"
alias cdl="conda list"
# this is here and not in condarc so comp can find local envs
export CONDA_ENVS_DIRS=$XDG_DATA_HOME/conda/envs
}
{{- end }}