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
# ZSH builtin autoload
2020-12-05 09:42:40 +00:00
if type brew & >/dev/null; then
2022-07-22 17:04:53 +01:00
FPATH = $( brew --prefix) /share/zsh/site-functions:$FPATH
2022-07-22 17:16:52 +01:00
FPATH = $( brew --prefix) /share/zsh/zsh-completions:$FPATH
2020-12-05 09:42:40 +00:00
fi
2022-10-10 17:44:51 +01:00
autoload -Uz compinit promptinit run-help zmv
2018-01-24 15:26:36 +00:00
compinit
promptinit
2019-11-16 09:21:54 +00:00
case $( type run-help) in
2022-07-22 17:04:53 +01:00
( *alias*) unalias run-help; ;
2019-11-16 09:21:54 +00:00
esac
2018-01-24 15:26:36 +00:00
alias help = run-help
# Persistant rehash to find new programs in the $PATH
zstyle ':completion:*' rehash true
# You may need to manually set your language environment
export LANG = en_GB.UTF-8
# Preferred editor for local and remote sessions
export EDITOR = 'vim'
# Set the DEFAULT_USER variable to me (jonny)
export DEFAULT_USER = "jonny"
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
eval " $( /opt/homebrew/bin/brew shellenv) "
fi
if [ [ -f /usr/local/bin/brew ] ] ; then
eval " $( /usr/local/bin/brew shellenv) "
fi
export PATH = " $HOME /.local/bin: $PATH "
2018-01-24 15:26:36 +00:00
2024-03-22 15:59:05 +00:00
# Source my own functions
source $HOME /.zsh/functions.zsh
2018-01-24 15:26:36 +00:00
# Determine the running OS
source $HOME /.zsh/platform.zsh
2024-03-22 15:59:05 +00:00
# Detect system appearance
export MACOS_APPEARANCE = ` get-system-appearance`
2018-01-24 15:26:36 +00:00
# ZSH syntax highlighting
source $HOME /.zsh/zsh-syntax-highlighting.zsh
# ZSH history substring search
source $HOME /.zsh/zsh-substring-search.zsh
# ZSH autosuggestions
2023-07-30 17:48:18 +01:00
source $HOME /.zsh/zsh-autosuggestions.zsh
2018-01-24 15:26:36 +00:00
# Aliases
source $HOME /.zsh/aliases.zsh
# 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`.
2018-01-24 15:26:36 +00:00
auto-ls ( ) {
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
}
chpwd_functions = ( auto-ls $chpwd_functions )
# Go Lang stuff
2020-11-16 17:39:32 +00:00
export GOPATH = $HOME /go
2023-05-21 18:22:10 +01:00
if type brew & >/dev/null; then
export PATH = " $PATH : $( brew --prefix) /go/bin: $( brew --prefix) /opt/go/libexec/bin: $GOPATH /bin "
fi
2018-01-24 15:26:36 +00:00
# GnuPG stuff
GPG_TTY = ` tty`
export GPG_TTY
2022-07-22 17:22:49 +01:00
# Add various GNU functions
2023-05-21 18:22:10 +01:00
if type brew & >/dev/null; then
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
2023-05-21 18:22:10 +01:00
if type brew & >/dev/null; then
export PATH = " $PATH : $( brew --prefix) /opt/ruby/bin: $HOME /.gem/ruby/2.4.0/bin "
fi
2018-01-24 15:26:36 +00:00
# PostgreSQL binaries
2023-05-21 18:22:10 +01:00
if type brew & >/dev/null; then
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
2023-05-21 18:22:10 +01:00
if type brew & >/dev/null; then
test -d $( brew --prefix) /opt/curl && export PATH = " $( brew --prefix) /opt/curl/bin: $PATH "
fi
2022-09-03 12:49:27 +01:00
2018-01-24 15:26:36 +00:00
# Colourised output for `ls`
2024-03-22 15:59:05 +00:00
# export CLICOLOR=true
# export CLICOLOR_FORCE=true
# export LSCOLORS='dxfxcxdxbxegedabagacad'
# export LS_COLORS='di=33;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:'
# vivid Dark mode ayu
# vivid Light mode snazzy
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
export LS_COLORS = " $( vivid generate $vividTheme ) "
2023-06-04 18:49:01 +01:00
fi
2018-01-24 15:26:36 +00:00
2023-07-30 21:26:04 +01:00
# Set colour scheme got bat
2024-03-22 15:59:05 +00:00
# bat Dark mode OneHalfDark
# bat Light mode Coldark-Dark
local batTheme = "OneHalfDark"
if [ [ $MACOS_APPEARANCE = = "light" ] ] ; then
2024-03-26 17:01:20 +00:00
batTheme = "base16-256"
2024-03-22 15:59:05 +00:00
fi
export BAT_THEME = $batTheme
2018-01-24 15:26:36 +00:00
2024-02-10 22:34:30 +00:00
# Setup fzf completions
export FZF_COMPLETION_TRIGGER = '~~'
2024-04-29 18:12:15 +01:00
if type fzf > /dev/null; then
eval " $( fzf --zsh) "
fi
2024-02-10 22:34:30 +00:00
2018-01-24 15:26:36 +00:00
# Source the iTerm2 shell integration
test -e ${ HOME } /.iterm2_shell_integration.zsh && source ${ HOME } /.iterm2_shell_integration.zsh
# Source the untracked `extra` file
test -e $HOME /.extra && source $HOME /.extra
2020-08-28 10:36:07 +01:00
2023-05-21 18:14:03 +01:00
# You Should Use
test -e /opt/homebrew/share/zsh-you-should-use/you-should-use.plugin.zsh && source /opt/homebrew/share/zsh-you-should-use/you-should-use.plugin.zsh
test -e /usr/share/zsh/plugins/zsh-you-should-use/you-should-use.plugin.zsh && source /usr/share/zsh/plugins/zsh-you-should-use/you-should-use.plugin.zsh
2024-01-23 19:10:15 +00:00
# Setup Fast Node Manager
2024-01-23 19:34:31 +00:00
if type fnm > /dev/null; then
eval " $( fnm env --use-on-cd) "
fi
2024-01-23 19:10:15 +00:00
2023-04-13 18:23:43 +01:00
# Setup GitHub Copilot
2024-03-22 16:17:21 +00:00
# first check we even have the genereic `gh` command
if type gh > /dev/null; then
# Now check we have the copilot plugin installed with `gh`
if gh extension list | rg copilot -c > /dev/null; then
eval " $( gh copilot alias -- zsh) "
fi
2023-04-13 18:23:43 +01:00
fi
2022-01-09 09:23:56 +00:00
# Init the fuck
2022-03-20 17:04:03 +00:00
if type thefuck > /dev/null; then
eval " $( thefuck --alias) "
2022-01-09 09:23:56 +00:00
fi
2022-02-17 17:38:15 +00:00
# https://github.com/wfxr/forgit
2022-07-22 17:16:52 +01:00
test -e $HOME /git/forgit/forgit.plugin.zsh && source $HOME /git/forgit/forgit.plugin.zsh
2023-06-18 12:03:10 +01:00
test -e $HOME /git/forgit/completionsgit-forgit.zsh && source $HOME /git/forgit/completionsgit-forgit.zsh
2022-02-17 17:38:15 +00:00
2022-03-13 07:09:28 +00:00
# McFly
2022-03-20 17:03:15 +00:00
if type mcfly > /dev/null; then
eval " $( mcfly init zsh) "
2022-03-13 07:09:28 +00:00
fi
2023-07-30 15:16:53 +01:00
# ngrok completions
if command -v ngrok & >/dev/null; then
eval " $( ngrok completion) "
fi
2024-02-16 18:28:58 +00:00
# zoxide - a better `cd` command
if command -v zoxide & >/dev/null; then
eval " $( zoxide init zsh) "
fi
2020-08-28 10:36:07 +01:00
# Init starship prompt -- https://starship.rs
eval " $( starship init zsh) "
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