diff --git a/_home/dot_sz.shrc.d/bash.post/99_chezmoi.complete b/_home/dot_sz.shrc.d/bash.post/99_chezmoi.complete index 14153a4..da06e6e 100644 --- a/_home/dot_sz.shrc.d/bash.post/99_chezmoi.complete +++ b/_home/dot_sz.shrc.d/bash.post/99_chezmoi.complete @@ -1 +1 @@ -[[ -n "$BASH_COMPLETION_EXIST" && -n $(type -fP chezmoi) ]] && source <(chezmoi completion bash) +[[ -n "$BASH_COMPLETION_EXIST" && -n $(type -fP chezmoi) ]] && source <(chezmoi completion bash | add-alias-to-bash-completion-code cz ) diff --git a/_home/dot_sz.shrc.d/bash.pre/21_aliases b/_home/dot_sz.shrc.d/bash.pre/21_aliases index a4f4935..c41f21e 100644 --- a/_home/dot_sz.shrc.d/bash.pre/21_aliases +++ b/_home/dot_sz.shrc.d/bash.pre/21_aliases @@ -1,2 +1,6 @@ alias which-command="type -fP " +function add-alias-to-bash-completion-code() { + local CMD=$(printf "%s" "sed '" 's/\(complete\W.*-F\W.*chezmoi\)/\1 ' "$1/g'") + eval "$CMD" +}