diff --git a/.bashrc b/.bashrc index 1543b20..1036b73 100644 --- a/.bashrc +++ b/.bashrc @@ -2,8 +2,6 @@ set -o vi -shopt -s autocd progcomp_alias - FZF_ALT_C_OPTS=--walker=dir,follow . /usr/share/fzf/key-bindings.bash @@ -11,9 +9,3 @@ for f in "$HOME/.config/bash/"*.bash; do # shellcheck disable=SC1090 . "$f" done - -complete -r -D -for f in kill kubectl git; do - # shellcheck disable=SC1090 - . "/usr/share/bash-completion/completions/$f" -done diff --git a/.config/bash/completion.bash b/.config/bash/completion.bash new file mode 100644 index 0000000..533899e --- /dev/null +++ b/.config/bash/completion.bash @@ -0,0 +1,30 @@ +shopt -s progcomp_alias + +complete -r -D +for f in kill kubectl git pacman ssh xrandr; do + # shellcheck disable=SC1090 + . "/usr/share/bash-completion/completions/$f" +done + +complete -F _pacman pac + +function _kns() { + mapfile -t COMPREPLY < <(compgen -W \ + "$(kubectl get namespace -o jsonpath='{..metadata.name}')" \ + -- "${COMP_WORDS[1]}") +} +complete -F _kns kns + +function _kctx() { + mapfile -t COMPREPLY < <(compgen -W \ + "$(kubectl config get-contexts -o name)" \ + -- "${COMP_WORDS[1]}") +} +complete -F _kctx kctx + +function _gi() { + mapfile -t COMPREPLY < <(compgen -W \ + "$(curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr ',' '\n')" \ + -- "${COMP_WORDS[1]}") +} +complete -F _gi gi diff --git a/.config/bash/git.bash b/.config/bash/git.bash index 43506f5..94e1be3 100644 --- a/.config/bash/git.bash +++ b/.config/bash/git.bash @@ -4,13 +4,6 @@ function gi() { curl -fL "https://www.toptal.com/developers/gitignore/api/$*" } -function _gi() { - mapfile -t COMPREPLY < <(compgen -W \ - "$(curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr ',' '\n')" \ - -- "${COMP_WORDS[1]}") -} -complete -F _gi gi - alias g='git' \ ga='git add' \ gaa='git add --all' \ @@ -29,6 +22,7 @@ alias g='git' \ gl='git pull' \ glo='git log --oneline --decorate' \ gmr='git merge' \ + gp='git push' \ gr='git remote' \ grb='git rebase' \ grev='git revert' \ diff --git a/.config/bash/k8s.bash b/.config/bash/k8s.bash index 3a8f714..e764e5e 100644 --- a/.config/bash/k8s.bash +++ b/.config/bash/k8s.bash @@ -18,13 +18,6 @@ function kns() { tee "$cache" <<< "$1" } -function _kns() { - mapfile -t COMPREPLY < <(compgen -W \ - "$(kubectl get namespace -o jsonpath='{..metadata.name}')" \ - -- "${COMP_WORDS[1]}") -} -complete -F _kns kns - function kctx() { local cache="$HOME/.local/state/${FUNCNAME[0]}" @@ -41,14 +34,6 @@ function kctx() { tee "$cache" <<< "$1" } -function _kctx() { - mapfile -t COMPREPLY < <(compgen -W \ - "$(kubectl config get-contexts -o name)" \ - -- "${COMP_WORDS[1]}") -} -complete -F _kctx kctx - - alias kga='kubectl get "$(kubectl api-resources --verbs=list --namespaced -oname | grep -v event | paste -sd,)"' alias k=kubectl \