From aa4af08e186c1519671916de48283606975abcf7 Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Sun, 31 Jul 2022 10:31:09 -0700 Subject: [PATCH] Add automatic install of zsh syntax highlighting --- dotfiles/zsh/zshrc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dotfiles/zsh/zshrc b/dotfiles/zsh/zshrc index 49e96b3..7dc43d8 100644 --- a/dotfiles/zsh/zshrc +++ b/dotfiles/zsh/zshrc @@ -50,14 +50,27 @@ fi if [[ ! -d $HOME/.zsh ]]; then echo "Installing zsh git completion scripts" mkdir -p $HOME/.zsh + pushd + cd $HOME/.zsh curl -o git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash curl -o _git https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh - cd $HOME + popd fi +# Install zsh-syntax-highlighting if it doesn't exist +if [[ ! -d $HOME/.zsh/zsh-syntax-highlighting ]]; then + echo "Installing zsh syntax highlighting" + pushd + + cd $HOME/.zsh + git clone https://github.com/zsh-users/zsh-syntax-highlighting.git + + popd +fi + zstyle ':completion:*:*:git:*' script $HOME/.zsh/git-completion.bash fpath=(~/.zsh $fpath) @@ -71,5 +84,8 @@ source $symlink_dir/exports.zsh source $symlink_dir/initializations.zsh source $symlink_dir/ps1.zsh +# ZSH syntax highlighting must be sourced last +source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + # ------------------------------ END SETUP ------------------------------ #