From d65e18856b76eee51929a7df7bd73ce96967a664 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Sat, 27 May 2023 00:40:53 -0700 Subject: [PATCH] Simplify zsh configs --- dot_config/zsh/zshrc.d/base-linux.zsh.tmpl | 3 - .../zsh/zshrc.d/{base.zsh => base.zsh.tmpl} | 57 +++++++++++++++++++ dot_config/zsh/zshrc.d/bat.zsh.tmpl | 5 -- dot_config/zsh/zshrc.d/direnv.zsh.tmpl | 3 - dot_config/zsh/zshrc.d/erdtree.zsh.tmpl | 6 -- dot_config/zsh/zshrc.d/helm.zsh.tmpl | 11 ---- dot_config/zsh/zshrc.d/kubectl.zsh.tmpl | 11 ---- dot_config/zsh/zshrc.d/ruby.zsh.tmpl | 15 ----- dot_config/zsh/zshrc.d/starship.zsh.tmpl | 4 -- dot_config/zsh/zshrc.d/tmux.zsh.tmpl | 6 -- 10 files changed, 57 insertions(+), 64 deletions(-) delete mode 100644 dot_config/zsh/zshrc.d/base-linux.zsh.tmpl rename dot_config/zsh/zshrc.d/{base.zsh => base.zsh.tmpl} (51%) delete mode 100644 dot_config/zsh/zshrc.d/bat.zsh.tmpl delete mode 100644 dot_config/zsh/zshrc.d/direnv.zsh.tmpl delete mode 100644 dot_config/zsh/zshrc.d/erdtree.zsh.tmpl delete mode 100644 dot_config/zsh/zshrc.d/helm.zsh.tmpl delete mode 100644 dot_config/zsh/zshrc.d/kubectl.zsh.tmpl delete mode 100644 dot_config/zsh/zshrc.d/ruby.zsh.tmpl delete mode 100644 dot_config/zsh/zshrc.d/starship.zsh.tmpl delete mode 100644 dot_config/zsh/zshrc.d/tmux.zsh.tmpl diff --git a/dot_config/zsh/zshrc.d/base-linux.zsh.tmpl b/dot_config/zsh/zshrc.d/base-linux.zsh.tmpl deleted file mode 100644 index 3457670..0000000 --- a/dot_config/zsh/zshrc.d/base-linux.zsh.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{ if lookPath "dircolors" -}} -eval "$(dircolors -b)" -{{- end }} diff --git a/dot_config/zsh/zshrc.d/base.zsh b/dot_config/zsh/zshrc.d/base.zsh.tmpl similarity index 51% rename from dot_config/zsh/zshrc.d/base.zsh rename to dot_config/zsh/zshrc.d/base.zsh.tmpl index 56c4f09..7e3d603 100644 --- a/dot_config/zsh/zshrc.d/base.zsh +++ b/dot_config/zsh/zshrc.d/base.zsh.tmpl @@ -29,3 +29,60 @@ 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' + +{{ if and (lookPath "dircolors") (eq .chezmoi.os "linux") -}} +eval "$(dircolors -b)" +{{ end -}} + +{{- if lookPath "bat" -}} +alias cat=bat +{{ end -}} + +{{- if lookPath "direnv" -}} +eval "$(direnv hook zsh)" +{{ end -}} + +{{- if lookPath "erd" -}} +autoload -Uz compinit +compinit +eval "$(erd --completions zsh)" +{{ end -}} + +{{- if lookPath "helm" -}} +# shellcheck disable=SC2148,SC1090 +autoload -U +X compinit && compinit +source <(helm completion zsh) +{{ end -}} + +{{- if lookPath "kubectl" -}} +# shellcheck disable=SC2148,SC1090 +autoload -U +X compinit && compinit +source <(kubectl completion zsh) +{{ end -}} + +{{- if lookPath "rbenv" -}} +if [ "${RBENV_SHELL}" = "" ]; then + eval "$(rbenv init -)" +fi +{{ end -}} + +{{- if lookPath "rvm" }} +if [[ -d "${HOME}/.rvm/bin" ]]; then + if [[ ! "${PATH}" =~ "${HOME}/.rvm/bin" ]]; then + export PATH="$PATH:$HOME/.rvm/bin" + fi +fi +{{ end -}} + +{{- if lookPath "starship" -}} +source <(starship init zsh) +{{ end -}} + +{{- if lookPath "tmux" }} +if [ "$TMUX" ]; then + # TERM=tmux-256color does not work as expected on osx + export TERM=screen-256color +fi +{{- end }} + +# vim: filetype=zsh diff --git a/dot_config/zsh/zshrc.d/bat.zsh.tmpl b/dot_config/zsh/zshrc.d/bat.zsh.tmpl deleted file mode 100644 index 43894a7..0000000 --- a/dot_config/zsh/zshrc.d/bat.zsh.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{{ if lookPath "bat" -}} -if command -v bat &> /dev/null ; then - alias cat=bat -fi -{{- end }} diff --git a/dot_config/zsh/zshrc.d/direnv.zsh.tmpl b/dot_config/zsh/zshrc.d/direnv.zsh.tmpl deleted file mode 100644 index c0531a1..0000000 --- a/dot_config/zsh/zshrc.d/direnv.zsh.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -{{ if lookPath "direnv" -}} -eval "$(direnv hook zsh)" -{{- end }} diff --git a/dot_config/zsh/zshrc.d/erdtree.zsh.tmpl b/dot_config/zsh/zshrc.d/erdtree.zsh.tmpl deleted file mode 100644 index 185cf30..0000000 --- a/dot_config/zsh/zshrc.d/erdtree.zsh.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -{{ if lookPath "erd" -}} -autoload -Uz compinit -compinit - -eval "$(erd --completions zsh)" -{{- end }} diff --git a/dot_config/zsh/zshrc.d/helm.zsh.tmpl b/dot_config/zsh/zshrc.d/helm.zsh.tmpl deleted file mode 100644 index 6130505..0000000 --- a/dot_config/zsh/zshrc.d/helm.zsh.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -{{ if lookPath "helm" -}} -# shellcheck disable=SC2148,SC1090 - -autoload -U +X compinit && compinit - -if command -v helm > /dev/null 2>&1 ; then - source <(helm completion zsh) -fi - -# vim: ft=bash -{{- end }} diff --git a/dot_config/zsh/zshrc.d/kubectl.zsh.tmpl b/dot_config/zsh/zshrc.d/kubectl.zsh.tmpl deleted file mode 100644 index 24361ed..0000000 --- a/dot_config/zsh/zshrc.d/kubectl.zsh.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -{{ if lookPath "kubectl" -}} -# shellcheck disable=SC2148,SC1090 - -autoload -U +X compinit && compinit - -if command -v kubectl > /dev/null 2>&1; then - source <(kubectl completion zsh) -fi - -# vim: ft=bash -{{- end }} diff --git a/dot_config/zsh/zshrc.d/ruby.zsh.tmpl b/dot_config/zsh/zshrc.d/ruby.zsh.tmpl deleted file mode 100644 index e1e58e8..0000000 --- a/dot_config/zsh/zshrc.d/ruby.zsh.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -{{ if lookPath "rbenv" -}} -if [ "${RBENV_SHELL}" = "" ]; then - if command -v rbenv >/dev/null 2>&1 ; then - eval "$(rbenv init -)" - fi -fi -{{- end }} - -{{ if lookPath "rvm" -}} -if [[ -d "${HOME}/.rvm/bin" ]]; then - if [[ ! "${PATH}" =~ "${HOME}/.rvm/bin" ]]; then - export PATH="$PATH:$HOME/.rvm/bin" - fi -fi -{{- end }} diff --git a/dot_config/zsh/zshrc.d/starship.zsh.tmpl b/dot_config/zsh/zshrc.d/starship.zsh.tmpl deleted file mode 100644 index 4863fb0..0000000 --- a/dot_config/zsh/zshrc.d/starship.zsh.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -{{ if lookPath "starship" -}} -# vim: ft=zsh -source <(starship init zsh) -{{- end }} diff --git a/dot_config/zsh/zshrc.d/tmux.zsh.tmpl b/dot_config/zsh/zshrc.d/tmux.zsh.tmpl deleted file mode 100644 index b4f1bb2..0000000 --- a/dot_config/zsh/zshrc.d/tmux.zsh.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -{{ if lookPath "tmux" -}} -if [ "$TMUX" ]; then - # TERM=tmux-256color does not work as expected on osx - export TERM=screen-256color -fi -{{- end }}