2018-01-24 15:26:36 +00:00
|
|
|
# User configuration
|
|
|
|
# history
|
|
|
|
HISTFILE=~/.histfile
|
|
|
|
HISTSIZE=10000
|
|
|
|
SAVEHIST=10000
|
2020-08-28 10:36:07 +01:00
|
|
|
|
2018-01-24 15:26:36 +00:00
|
|
|
# vim binddings
|
|
|
|
bindkey -v
|
2020-08-28 10:36:07 +01:00
|
|
|
|
2018-01-24 15:26:36 +00:00
|
|
|
# You may need to manually set your language environment
|
|
|
|
export LANG=en_GB.UTF-8
|
|
|
|
|
|
|
|
# Preferred editor for local and remote sessions
|
2024-07-06 11:44:31 +01:00
|
|
|
export EDITOR=nvim
|
2018-01-24 15:26:36 +00:00
|
|
|
|
2022-03-20 18:05:57 +00:00
|
|
|
# Autoadd to PATH (neede for MacTex)
|
|
|
|
# It prepends to $PATH, so we do it first then add our own
|
2022-04-15 17:16:44 +01:00
|
|
|
if [[ -f /usr/libexec/path_helper ]]; then
|
2022-07-22 17:04:53 +01:00
|
|
|
eval $(/usr/libexec/path_helper)
|
2022-04-15 17:16:44 +01:00
|
|
|
fi
|
2022-03-20 18:05:57 +00:00
|
|
|
|
|
|
|
# Add our own dirs to the $PATH
|
2024-04-29 18:12:15 +01:00
|
|
|
if [[ -f /opt/homebrew/bin/brew ]]; then
|
2024-07-06 11:44:31 +01:00
|
|
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
2024-04-29 18:12:15 +01:00
|
|
|
fi
|
|
|
|
if [[ -f /usr/local/bin/brew ]]; then
|
2024-07-06 11:44:31 +01:00
|
|
|
eval "$(/usr/local/bin/brew shellenv)"
|
2024-04-29 18:12:15 +01:00
|
|
|
fi
|
|
|
|
export PATH="$HOME/.local/bin:$PATH"
|
2018-01-24 15:26:36 +00:00
|
|
|
|
|
|
|
# credit Paul Irish: https://github.com/paulirish/dotfiles/blob/606d85f083eb53853789ce9dcaf31a49756471bd/.zshrc#L80
|
|
|
|
# Automatically list directory contents on `cd`.
|
2021-07-17 18:05:58 +01:00
|
|
|
# Switched to using `exa` instead of `ls`.
|
2024-05-17 16:47:54 +01:00
|
|
|
ezacd () {
|
2022-07-22 17:04:53 +01:00
|
|
|
emulate -L zsh;
|
2021-07-17 18:05:58 +01:00
|
|
|
|
2023-09-07 16:13:12 +01:00
|
|
|
eza --oneline --long --classify --icons --header
|
2018-01-24 15:26:36 +00:00
|
|
|
}
|
2025-01-19 13:42:37 +00:00
|
|
|
# Initialize chpwd_functions if it doesn't exist
|
|
|
|
typeset -ga chpwd_functions
|
2025-01-19 13:38:48 +00:00
|
|
|
# Only add ezacd to chpwd_functions if it's not already there
|
2025-01-19 13:42:37 +00:00
|
|
|
if [[ ${chpwd_functions[(ie)ezacd]} -gt ${#chpwd_functions} ]]; then
|
2025-01-19 13:38:48 +00:00
|
|
|
chpwd_functions=(${chpwd_functions[@]} "ezacd")
|
|
|
|
fi
|
2018-01-24 15:26:36 +00:00
|
|
|
|
|
|
|
# Go Lang stuff
|
2020-11-16 17:39:32 +00:00
|
|
|
export GOPATH=$HOME/go
|
2024-07-06 11:44:31 +01:00
|
|
|
if (( ${+commands[brew]} )); then
|
2023-05-21 18:22:10 +01:00
|
|
|
export PATH="$PATH:$(brew --prefix)/go/bin:$(brew --prefix)/opt/go/libexec/bin:$GOPATH/bin"
|
|
|
|
fi
|
2018-01-24 15:26:36 +00:00
|
|
|
|
2022-07-22 17:22:49 +01:00
|
|
|
# Add various GNU functions
|
2024-07-06 11:44:31 +01:00
|
|
|
# Prepend them to the PATH so they override any system installed versions
|
|
|
|
if (( ${+commands[brew]} )); then
|
2023-05-21 18:22:10 +01:00
|
|
|
export PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:$PATH"
|
|
|
|
export PATH="$(brew --prefix)/opt/findutils/libexec/gnubin:$PATH"
|
|
|
|
export PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
|
|
|
|
export PATH="$(brew --prefix)/opt/grep/libexec/gnubin:$PATH"
|
|
|
|
fi
|
2022-07-22 17:22:49 +01:00
|
|
|
|
2022-07-13 15:47:41 +01:00
|
|
|
# Add Totara Docker helper functions
|
|
|
|
export PATH="$PATH:$HOME/git/totara-docker-dev/bin"
|
|
|
|
|
2022-03-09 18:28:16 +00:00
|
|
|
# Set the rip (Rm ImProved) graveyard
|
|
|
|
export GRAVEYARD="$HOME/.local/share/Trash"
|
|
|
|
|
2018-01-24 15:26:36 +00:00
|
|
|
# composer global
|
|
|
|
export PATH="$PATH:$HOME/.composer/vendor/bin"
|
|
|
|
|
|
|
|
# rust/cargo bin PATH
|
|
|
|
export PATH="$PATH:$HOME/.cargo/bin"
|
|
|
|
|
|
|
|
# Ruby PATH
|
2024-07-06 11:44:31 +01:00
|
|
|
if (( ${+commands[brew]} )); then
|
|
|
|
export PATH="$PATH:$(brew --prefix)/opt/ruby/bin"
|
2023-05-21 18:22:10 +01:00
|
|
|
fi
|
2018-01-24 15:26:36 +00:00
|
|
|
|
|
|
|
# PostgreSQL binaries
|
2024-07-06 11:44:31 +01:00
|
|
|
if (( ${+commands[brew]} )); then
|
2023-05-21 18:22:10 +01:00
|
|
|
test -d $(brew --prefix)/pgsql && export PATH="$PATH:$(brew --prefix)/pgsql/bin"
|
|
|
|
fi
|
2018-01-24 15:26:36 +00:00
|
|
|
|
|
|
|
# PHP binaries
|
|
|
|
test -d $HOME/.php/bin && export PATH="$PATH:$HOME/.php/bin"
|
|
|
|
|
2022-07-22 17:04:53 +01:00
|
|
|
# JetBrains Toolbox scripts
|
|
|
|
test -d "$HOME/Library/Application Support/JetBrains/Toolbox/scripts" && export PATH="$PATH:$HOME/Library/Application Support/JetBrains/Toolbox/scripts"
|
|
|
|
|
2022-09-03 12:49:27 +01:00
|
|
|
# Homebrew cURL if we have it
|
2024-07-06 11:44:31 +01:00
|
|
|
if (( ${+commands[brew]} )); then
|
2023-05-21 18:22:10 +01:00
|
|
|
test -d $(brew --prefix)/opt/curl && export PATH="$(brew --prefix)/opt/curl/bin:$PATH"
|
|
|
|
fi
|
2022-09-03 12:49:27 +01:00
|
|
|
|
2024-07-06 11:44:31 +01:00
|
|
|
|
|
|
|
# Load plugins via Sheldon
|
|
|
|
if (( ${+commands[sheldon]} )); then
|
|
|
|
eval "$(sheldon source)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Detect system appearance
|
|
|
|
export MACOS_APPEARANCE=`get-system-appearance`
|
|
|
|
|
2018-01-24 15:26:36 +00:00
|
|
|
# Colourised output for `ls`
|
2024-03-22 15:59:05 +00:00
|
|
|
# vivid Dark mode ayu
|
2024-07-06 11:44:31 +01:00
|
|
|
# vivid Light mode catppuccin-latte
|
2023-06-04 18:49:01 +01:00
|
|
|
if type vivid &>/dev/null; then
|
2024-03-22 15:59:05 +00:00
|
|
|
local vividTheme="ayu"
|
|
|
|
if [[ $MACOS_APPEARANCE == "light" ]]; then
|
2024-04-29 18:12:15 +01:00
|
|
|
vividTheme="catppuccin-latte"
|
2024-03-22 15:59:05 +00:00
|
|
|
fi
|
2024-07-06 11:44:31 +01:00
|
|
|
|
2024-03-22 15:59:05 +00:00
|
|
|
export LS_COLORS="$(vivid generate $vividTheme)"
|
2023-06-04 18:49:01 +01:00
|
|
|
fi
|
2018-01-24 15:26:36 +00:00
|
|
|
|
2025-01-19 13:32:17 +00:00
|
|
|
# Set colour scheme for bat
|
|
|
|
export BAT_THEME_LIGHT="GitHub"
|
|
|
|
export BAT_THEME_DARK="Sublime Snazzy"
|
2018-01-24 15:26:36 +00:00
|
|
|
|
|
|
|
# Source the untracked `extra` file
|
|
|
|
test -e $HOME/.extra && source $HOME/.extra
|
2020-08-28 10:36:07 +01:00
|
|
|
|
2024-08-23 14:15:51 +01:00
|
|
|
# Set the prompt
|
|
|
|
# We need zsh git integration
|
|
|
|
# Autoload zsh's `add-zsh-hook` and `vcs_info` functions
|
|
|
|
# (-U autoload w/o substition, -z use zsh style)
|
|
|
|
autoload -Uz add-zsh-hook vcs_info
|
|
|
|
|
|
|
|
# Set prompt substitution so we can use the vcs_info_message variable
|
|
|
|
setopt prompt_subst
|
|
|
|
|
|
|
|
# Run the `vcs_info` hook to grab git info before displaying the prompt
|
|
|
|
add-zsh-hook precmd vcs_info
|
|
|
|
|
|
|
|
# Style the vcs_info message
|
|
|
|
zstyle ':vcs_info:*' enable git
|
2024-08-23 14:26:53 +01:00
|
|
|
zstyle ':vcs_info:git*' formats '⎇ %b%u%c'
|
2024-08-23 14:15:51 +01:00
|
|
|
# Format when the repo is in an action (merge, rebase, etc)
|
|
|
|
zstyle ':vcs_info:git*' actionformats '%F{14}⏱ %*%f'
|
|
|
|
zstyle ':vcs_info:git*' unstagedstr '*'
|
|
|
|
zstyle ':vcs_info:git*' stagedstr '+'
|
|
|
|
# This enables %u and %c (unstaged/staged changes) to work,
|
|
|
|
# but can be slow on large repos
|
|
|
|
zstyle ':vcs_info:*:*' check-for-changes true
|
|
|
|
|
2024-09-20 21:18:21 +01:00
|
|
|
# First show the Loading indicator in the right prompt if shell plugins are still loading
|
|
|
|
RPROMPT='%F{8}$(if [[ -n $SHELL_LOADING ]]; then echo "Loading... "; fi)'
|
|
|
|
|
|
|
|
# Then we can also show the git branch
|
|
|
|
RPROMPT+='${vcs_info_msg_0_}'
|
2024-08-23 14:15:51 +01:00
|
|
|
|
2024-08-29 09:37:36 +01:00
|
|
|
# First set a dot that changes colour on success/fail or previous command
|
|
|
|
PROMPT='%(?.%F{blue}⏺.%F{red}⏺)%f '
|
|
|
|
# Show a symbol for the OS
|
|
|
|
# First we set the os_symbol variable we will use in the prompt
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
os_symbol=""
|
|
|
|
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
|
|
os_symbol=""
|
|
|
|
else
|
|
|
|
os_symbol="" # Fallback symbol if OS is neither macOS nor Linux
|
|
|
|
fi
|
|
|
|
|
|
|
|
PROMPT+='${os_symbol} '
|
|
|
|
# Then show the working directory
|
|
|
|
PROMPT+='%2~ '
|
|
|
|
# Finally we can adjust the prompt to show if we are a user or sudo
|
|
|
|
PROMPT+='%(!.#.$) '
|
2024-03-22 15:59:05 +00:00
|
|
|
|
|
|
|
# Finally we can have zsh auto source this rc file on command
|
|
|
|
# attribution: https://www.reddit.com/r/commandline/comments/12g76v/
|
|
|
|
trap "source $HOME/.zshrc" USR1
|