Browse Source

Add zsh syntax highlighting with version checks

master
Taylor Bockman 2 years ago
parent
commit
e893a0a0fa
  1. 6
      README.md
  2. 10
      dotfiles/zsh/zshrc

6
README.md

@ -23,7 +23,11 @@ The directory structure is as follows:
## Terminal ## Terminal
I am back to `zsh` after a long time with `bash`. See the `dotfiles/zsh` directory. You only need to I am back to `zsh` after a long time with `bash`. See the `dotfiles/zsh` directory. You only need to
symlink `.zprofile` and `.zshrc` to your home directory. symlink `.zprofile` and `.zshrc` to your home directory. Refer to the `README.md` in the directory
for more information.
My `.zshrc` installs a lot of nice conveniences. For example, fish-shell-like syntax highlighting and
git completion.
## Vim ## Vim

10
dotfiles/zsh/zshrc

@ -7,8 +7,6 @@ else
symlink_dir=$(cd "$( dirname "`readlink ${(%):-%N}`" )" && pwd) symlink_dir=$(cd "$( dirname "`readlink ${(%):-%N}`" )" && pwd)
fi fi
# -------------------------------- SETUP -------------------------------- #
# Store private information (exports, keys, etc) in .bash_private. # Store private information (exports, keys, etc) in .bash_private.
if [[ -f $HOME/.bash_private ]]; then if [[ -f $HOME/.bash_private ]]; then
source $HOME/.bash_private source $HOME/.bash_private
@ -62,6 +60,9 @@ fi
# Install zsh-syntax-highlighting if it doesn't exist # Install zsh-syntax-highlighting if it doesn't exist
if [[ ! -d $HOME/.zsh/zsh-syntax-highlighting ]]; then if [[ ! -d $HOME/.zsh/zsh-syntax-highlighting ]]; then
if ! is-at-least 4.3.11; then
echo "ZSH syntax highlighting requires ZSH >= 4.3.11 (current: $ZSH_VERSION)."
else
echo "Installing zsh syntax highlighting" echo "Installing zsh syntax highlighting"
pushd pushd
@ -71,6 +72,8 @@ if [[ ! -d $HOME/.zsh/zsh-syntax-highlighting ]]; then
popd popd
fi fi
fi
zstyle ':completion:*:*:git:*' script $HOME/.zsh/git-completion.bash zstyle ':completion:*:*:git:*' script $HOME/.zsh/git-completion.bash
fpath=(~/.zsh $fpath) fpath=(~/.zsh $fpath)
@ -86,6 +89,3 @@ source $symlink_dir/ps1.zsh
# ZSH syntax highlighting must be sourced last # ZSH syntax highlighting must be sourced last
source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# ------------------------------ END SETUP ------------------------------ #

Loading…
Cancel
Save