diff --git a/states/zsh/config.sls b/states/zsh/config.sls index b5be72e..5783b0b 100644 --- a/states/zsh/config.sls +++ b/states/zsh/config.sls @@ -15,6 +15,10 @@ zsh-autosuggestions-repo: - require: - pkg: zsh-pkg +zsh-omz-env-old: + file.absent: + - name: /etc/zsh/zprofile + zsh-omz-env: file.managed: - name: /etc/zsh/zshenv diff --git a/states/zsh/zshenv.j2 b/states/zsh/zshenv.j2 index 8950325..04f2ab1 100644 --- a/states/zsh/zshenv.j2 +++ b/states/zsh/zshenv.j2 @@ -1,7 +1,10 @@ ## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }} {%- from "zsh/map.jinja" import zsh with context %} -export PATH=$PATH:/usr/local/bin:/usr/local/sbin +if [[ $PATH != *"/usr/local/bin:/usr/local/sbin"* ]] +then + export PATH=$PATH:/usr/local/bin:/usr/local/sbin +fi # Main environments variables export EDITOR=nvim @@ -9,7 +12,7 @@ export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee' {% if zsh.config.golang -%} # Golang settings -if [[ -d /usr/local/apps/golang ]] +if [[ -d /usr/local/apps/golang && $PATH != *"golang"* ]] then export GOPATH=~/go export GOROOT=/usr/local/apps/golang @@ -20,7 +23,7 @@ fi {% if zsh.config.rust -%} # Rust settings -if [[ -d ~/.cargo/bin ]] +if [[ -d ~/.cargo/bin && $PATH != *"cargo"* ]] then export PATH=$PATH:$HOME/.cargo/bin fi @@ -44,11 +47,6 @@ plugins=(common-aliases git) plugins=(common-aliases sudo docker salt git ansible command-not-found systemd python nmap zsh-autosuggestions golang rust kubectl) {%- endif %} -{# -#for example -#plugins=(common-aliases sudo docker salt git ansible command-not-found virtualenvwrapper tmux systemd python golang nmap) -#} - if [[ -f $ZSH/oh-my-zsh.sh ]] then source $ZSH/oh-my-zsh.sh