dotfiles/zshrc.zsh

155 lines
4.5 KiB
Bash
Raw Normal View History

2022-07-13 15:47:41 +01:00
# Fig pre block. Keep at the top of this file.
2022-09-15 08:38:24 +01:00
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
# Fig pre block. Keep at the top of this file.
2022-03-13 07:09:28 +00:00
# User configuration
# history
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000
2020-08-28 10:36:07 +01:00
# vim binddings
bindkey -v
2020-08-28 10:36:07 +01: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
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
compinit
promptinit
case $(type run-help) in
2022-07-22 17:04:53 +01:00
(*alias*) unalias run-help;;
esac
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
if [[ -f /usr/libexec/path_helper ]]; then
2022-07-22 17:04:53 +01:00
eval $(/usr/libexec/path_helper)
fi
2022-03-20 18:05:57 +00:00
# Add our own dirs to the $PATH
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/opt/homebrew/sbin:/usr/local/sbin:/usr/sbin:/sbin:$HOME/.local/bin:$PATH"
2021-07-17 18:32:27 +01:00
export MANPATH="/opt/homebrew/manpages:/usr/local/man:$MANPATH"
# Determine the running OS
source $HOME/.zsh/platform.zsh
# ZSH syntax highlighting
source $HOME/.zsh/zsh-syntax-highlighting.zsh
# ZSH history substring search
source $HOME/.zsh/zsh-substring-search.zsh
# ZSH autosuggestions
source $HOME/.zsh/zsh-autosuggestions.zsh
# Aliases
source $HOME/.zsh/aliases.zsh
# credit Paul Irish: https://github.com/paulirish/dotfiles/blob/606d85f083eb53853789ce9dcaf31a49756471bd/.zshrc#L80
# Automatically list directory contents on `cd`.
# Switched to using `exa` instead of `ls`.
auto-ls () {
2022-07-22 17:04:53 +01:00
emulate -L zsh;
2022-07-22 17:04:53 +01:00
exa --oneline --long --classify --icons --header
}
chpwd_functions=( auto-ls $chpwd_functions )
# Go Lang stuff
2020-11-16 17:39:32 +00:00
export GOPATH=$HOME/go
export PATH="$PATH:$(brew --prefix)/go/bin:$(brew --prefix)/opt/go/libexec/bin:$GOPATH/bin"
# GnuPG stuff
GPG_TTY=`tty`
export GPG_TTY
2022-07-22 17:22:49 +01:00
# Add various GNU functions
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"
2022-09-15 08:38:24 +01:00
export PATH="$(brew --prefix)/opt/grep/libexec/gnubin:$PATH"
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"
# Set the rip (Rm ImProved) graveyard
export GRAVEYARD="$HOME/.local/share/Trash"
# composer global
export PATH="$PATH:$HOME/.composer/vendor/bin"
# rust/cargo bin PATH
export PATH="$PATH:$HOME/.cargo/bin"
# Ruby PATH
export PATH="$PATH:$(brew --prefix)/opt/ruby/bin:$HOME/.gem/ruby/2.4.0/bin"
# PostgreSQL binaries
test -d $(brew --prefix)/pgsql && export PATH="$PATH:$(brew --prefix)/pgsql/bin"
# PHP binaries
test -d $HOME/.php/bin && export PATH="$PATH:$HOME/.php/bin"
2019-12-06 10:36:38 +00:00
# macOS Python User binaries
test -d $HOME/Library/Python/3.7/bin && export PATH="$PATH:$HOME/Library/Python/3.7/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
test -d $(brew --prefix)/opt/curl && export PATH="$(brew --prefix)/opt/curl/bin:$PATH"
# Set Homebrew Env variables
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_AUTO_UPDATE_SECS=3600
2022-09-07 20:27:01 +01:00
export HOMEBREW_INSTALL_FROM_API=true
# Colourised output for `ls`
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:'
# Source my own functions
test -e $HOME/.zsh/functions.zsh && source $HOME/.zsh/functions.zsh
# 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
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
test -e $HOME/git/forgit/forgit.plugin.zsh && source $HOME/git/forgit/forgit.plugin.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
2020-08-28 10:36:07 +01:00
# Init starship prompt -- https://starship.rs
eval "$(starship init zsh)"
2022-03-13 07:09:28 +00:00
# Fig post block. Keep at the bottom of this file.
2022-09-15 08:38:24 +01:00
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"