diff --git a/.config/dotfiles/aliases.sh b/.aliases similarity index 100% rename from .config/dotfiles/aliases.sh rename to .aliases diff --git a/.config/dotfiles/env-shared.sh b/.config/dotfiles/env-shared.sh deleted file mode 100644 index 806553b..0000000 --- a/.config/dotfiles/env-shared.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -export CC=clang -export CXX=clang++ -export PATH="/usr/lib/ccache:$PATH" -export ZSH=$HOME/.oh-my-zsh - -if ! echo "$PATH" | grep -q "$HOME/.local/bin" -then - export PATH="$PATH:$HOME/.local/bin" -fi - -# shellcheck disable=SC2016 -export ROSCONSOLE_FORMAT='[${severity}] [${node}] [${time}]: ${message}' diff --git a/.config/dotfiles/install.sh b/.config/dotfiles/install.sh index dd5dac4..96567f5 100755 --- a/.config/dotfiles/install.sh +++ b/.config/dotfiles/install.sh @@ -114,10 +114,8 @@ echo "Done" # Setup ZSH with oh-my-zsh bold "Setting up Oh My Zsh" -if [[ -d ~/.oh-my-zsh ]]; then - echo "Oh My Zsh already installed" -else - sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended +if [[ ! -d ~/.oh-my-zsh ]]; then + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" fi echo "Done" diff --git a/.zshrc b/.zshrc index b55ed64..d268f34 100644 --- a/.zshrc +++ b/.zshrc @@ -1,19 +1,10 @@ -DOTFILES="${HOME}/.config/dotfiles" - -function source_if_found { [[ -f "$1" ]] && source "$1"; } - ############################################################ -# environment # +# ZSH setup # ############################################################ -source "$DOTFILES"/env-shared.sh -source_if_found "$DOTFILES"/env-machine-specific.sh -source "$DOTFILES"/aliases.sh - -############################################################ -# shell # -############################################################ +export ZSH=$HOME/.oh-my-zsh +# Set up prompt ZSH_THEME="bullet-train" BULLETTRAIN_STATUS_EXIT_SHOW=true BULLETTRAIN_EXEC_TIME_ELAPSED=1 @@ -21,6 +12,7 @@ BULLETTRAIN_PROMPT_CHAR= BULLETTRAIN_PROMPT_SEPARATE_LINE=false BULLETTRAIN_PROMPT_ADD_NEWLINE=false BULLETTRAIN_PROMPT_ORDER=(status custom dir git hg cmd_exec_time) + ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=2" # Green autosuggestion text. # Distinct prompt in Docker @@ -30,15 +22,32 @@ then BULLETTRAIN_PROMPT_CHAR=🐋 fi -plugins=(gitfast zsh-autosuggestions zsh-256color) +plugins=( + git + zsh-autosuggestions +) + +source $ZSH/oh-my-zsh.sh + +############################################################ +# environment setup # +############################################################ + +export CC=clang +export CXX=clang++ + +# Add ccache to path +[[ ! "$PATH" =~ /usr/lib/ccache ]] && export PATH="/usr/lib/ccache:$PATH" -source "$ZSH/oh-my-zsh.sh" +# Add ~/.local/bin to path +[[ ! "$PATH" =~ "$HOME/.local/bin" ]] && export PATH="$PATH:$HOME/.local/bin" -setopt nonomatch +source ~/.aliases +[[ -e ~/.zshrc-local ]] && source ~/.zshrc-local ############################################################ -# keyboard # +# ROS # ############################################################ -# Make sure AltGr + Space produces normal, not non-breaking, space. -command -v setxkbmap > /dev/null && setxkbmap -option "nbsp:none" +# shellcheck disable=SC2016 +export ROSCONSOLE_FORMAT='[${severity}] [${node}] [${time}]: ${message}'