252 lines
6.7 KiB
Text
252 lines
6.7 KiB
Text
source /etc/zshrc
|
|
|
|
# Secret stuff
|
|
source $HOME/.zsh/secret
|
|
|
|
# Fuzzy finder!
|
|
source $HOME/.zsh/fzf.zsh
|
|
export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --glob "!.git/*"'
|
|
|
|
## Path
|
|
# Default path
|
|
export PATH="/sbin"
|
|
PATH="/usr/sbin:$PATH"
|
|
PATH="/bin:$PATH"
|
|
PATH="/usr/bin:$PATH"
|
|
PATH="/usr/local/sbin:$PATH"
|
|
PATH="/usr/local/bin:$PATH"
|
|
|
|
# Homebrew (generated by `brew shellenv`, lightly modified)
|
|
export HOMEBREW_PREFIX="/opt/homebrew"
|
|
export HOMEBREW_CELLAR="/opt/homebrew/Cellar"
|
|
export HOMEBREW_REPOSITORY="/opt/homebrew"
|
|
export HOMEBREW_NO_ENV_HINTS=1
|
|
|
|
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:"
|
|
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"
|
|
|
|
PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH}"
|
|
|
|
# Composer (PHP)
|
|
PATH="$HOME/.composer/vendor/bin:$PATH"
|
|
export COMPOSER_HOME="$HOME/.composer"
|
|
|
|
# Python
|
|
export PYTHONPATH="$PYTHONPATH:$HOME/dotfiles/lib/python"
|
|
|
|
# Rust
|
|
source $HOME/.cargo/env
|
|
|
|
# Ruby (2.7)
|
|
export PATH="/opt/homebrew/lib/ruby/gems/2.7.0/bin:$PATH"
|
|
|
|
# Go
|
|
export GOPATH="$HOME/go"
|
|
export GOBIN="$GOPATH/bin"
|
|
PATH="$GOBIN:$PATH"
|
|
|
|
# JS stuff
|
|
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
|
|
export PATH="$HOME/.rover/bin:$PATH"
|
|
export PATH="$PATH:/opt/homebrew/Cellar/node@18/18.20.4/bin"
|
|
|
|
# Local path
|
|
PATH="$HOME/dotfiles/bin/misc:$PATH"
|
|
PATH="$HOME/dotfiles/bin:$PATH"
|
|
PATH="$HOME/bin:$PATH"
|
|
|
|
# Playdate!
|
|
export PLAYDATE_SDK_PATH="$HOME/Developer/PlaydateSDK"
|
|
|
|
# Android
|
|
export ANDROID_HOME="$HOME/Library/Android/sdk"
|
|
export PATH="$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools:$PATH"
|
|
|
|
# Library Stuff
|
|
export CPATH="$HOMEBREW_PREFIX/include:$CPATH"
|
|
export LIBRARY_PATH="$HOMEBREW_PREFIX/lib:$LIBRARY_PATH"
|
|
|
|
## Completion
|
|
|
|
# Load up the extra Z Shell completions
|
|
fpath=("$HOME/.zsh/zsh-completions/src" $fpath)
|
|
|
|
# Ensure we can run the compinit to make them work.
|
|
autoload compinit
|
|
|
|
# Initialise better autocompletion
|
|
compinit
|
|
|
|
source "$HOME/.zsh/_bazel"
|
|
|
|
## Syntax Highlighting
|
|
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
|
|
# Make errors red
|
|
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red'
|
|
|
|
# Turn just about everything else off
|
|
ZSH_HIGHLIGHT_STYLES[reserved-word]='none'
|
|
ZSH_HIGHLIGHT_STYLES[reserved-word]='none'
|
|
ZSH_HIGHLIGHT_STYLES[alias]='none'
|
|
ZSH_HIGHLIGHT_STYLES[builtin]='none'
|
|
ZSH_HIGHLIGHT_STYLES[function]='none'
|
|
ZSH_HIGHLIGHT_STYLES[command]='none'
|
|
ZSH_HIGHLIGHT_STYLES[precommand]='none'
|
|
ZSH_HIGHLIGHT_STYLES[commandseparator]='none'
|
|
ZSH_HIGHLIGHT_STYLES[hashed-command]='none'
|
|
ZSH_HIGHLIGHT_STYLES[path]='none'
|
|
ZSH_HIGHLIGHT_STYLES[path_prefix]='none'
|
|
ZSH_HIGHLIGHT_STYLES[path_approx]='none'
|
|
ZSH_HIGHLIGHT_STYLES[globbing]='none'
|
|
ZSH_HIGHLIGHT_STYLES[history-expansion]='none'
|
|
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='none'
|
|
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='none'
|
|
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='none'
|
|
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='none'
|
|
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='none'
|
|
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='none'
|
|
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='none'
|
|
ZSH_HIGHLIGHT_STYLES[assign]='none'
|
|
ZSH_HIGHLIGHT_STYLES[default]='none'
|
|
|
|
# Set editor
|
|
export EDITOR="/usr/local/bin/nova"
|
|
|
|
# Get the first part of the hostname
|
|
#
|
|
# Sometimes they have dots in them, I'm not partial to that.
|
|
function nice-hostname {
|
|
echo $(command hostname | cut -d . -f 1)
|
|
}
|
|
|
|
# Don't beep at me when I do something wrong.
|
|
#
|
|
# I found it was beeping when I wasn't doing something wrong, and that
|
|
# really gets on my nerves.
|
|
setopt no_beep
|
|
|
|
unset zle_bracketed_paste
|
|
|
|
## Changing Directories
|
|
|
|
# If a command cannot be executed, try cd.
|
|
#
|
|
# This is an old Fish option that I sometimes made use of.
|
|
setopt auto_cd
|
|
|
|
# Use pushd instead of cd
|
|
#
|
|
# Pushd is a thing that maintains a history of directories in a stack.
|
|
# It turns out that this is incredibly useful.
|
|
setopt auto_pushd
|
|
|
|
# Resolve links to their actual directory.
|
|
#
|
|
# Not doing this causes several unpleasant conflicts. Fish made the
|
|
# right call by not doing this. See:
|
|
#
|
|
# http://fishshell.com/docs/current/faq.html#faq-cwd-symlink
|
|
#
|
|
# > ...it is impossible to consistently keep symlinked directories
|
|
# > unresolved. It is indeed possible to do this partially, and many
|
|
# > other shells do so. But it was felt there are enough serious corner
|
|
# > cases that this is a bad idea. Most such issues have to do with how
|
|
# > '..' is handled...
|
|
setopt chase_links
|
|
|
|
# Do not print the directory stack on each pushd (cd)
|
|
setopt pushd_silent
|
|
|
|
# Pushd with no arguments is like cd with no arguments
|
|
setopt pushd_to_home
|
|
|
|
## History
|
|
|
|
# Save history between sessions.
|
|
#
|
|
# Zsh doesn't do this by default, and I don't know why.
|
|
HISTSIZE=10000
|
|
SAVEHIST=10000
|
|
HISTFILE="$HOME/.zsh_history"
|
|
|
|
# Don't beep at me when I do something wrong
|
|
setopt no_hist_beep
|
|
|
|
# Tell Z Shell to append to the history file.
|
|
#
|
|
# The other option is to write to it each session.
|
|
setopt append_history
|
|
|
|
# Store more information in the history file.
|
|
#
|
|
# This option will store the timestamp corresponding to when the
|
|
# command started, as well as its duration. I'm turning this on
|
|
# because I don't see why I wouldn't want more information.
|
|
setopt extended_history
|
|
|
|
# Apparently, there is a bug in the way Z Shell handles words.
|
|
#
|
|
# This option enforces correct behaviour, but can be slower. We'll try
|
|
# to do things correctly and see if it's slow.
|
|
setopt hist_lex_words
|
|
|
|
# Liquid Prompt!
|
|
source /opt/homebrew/share/liquidprompt
|
|
|
|
# Vim!
|
|
alias vim=nvim
|
|
# I made this typo once and never again.
|
|
alias vi=nvim
|
|
alias v=nvim
|
|
|
|
# Bazel -__-
|
|
alias bazel='bazelisk'
|
|
|
|
# Use fzf to select a running tmux session to attach to
|
|
function select_session_interactive {
|
|
tmux list-sessions 2> /dev/null |
|
|
cut -d":" -f 1 |
|
|
cat - <(echo "Create new session") |
|
|
fzf --height 30% --layout=reverse --border
|
|
}
|
|
|
|
# On startup, I want to be prompted to join a Tmux session.
|
|
#
|
|
# Simply cancelling the command will leave me in native terminal mode.
|
|
function select_session {
|
|
if [ -z "$TMUX" ]
|
|
then
|
|
local selected_session=$(select_session_interactive)
|
|
|
|
if [[ "$selected_session" == "Create new session" ]]
|
|
then
|
|
echo -n "Session name: "
|
|
read new_session_name
|
|
tmux new-session -s "$new_session_name"
|
|
elif [[ -n "$selected_session" ]]
|
|
then
|
|
tmux attach -t "$selected_session"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Disabling the below because Tmux has been playing up.
|
|
#
|
|
# if [ -z "$TMUX" ]
|
|
# then
|
|
# neofetch
|
|
# fi
|
|
|
|
# select_session
|
|
|
|
source "$(brew --prefix)/share/google-cloud-sdk/path.zsh.inc"
|
|
source "$(brew --prefix)/share/google-cloud-sdk/completion.zsh.inc"
|
|
|
|
# pnpm
|
|
export PNPM_HOME="/Users/maxbucknell/Library/pnpm"
|
|
case ":$PATH:" in
|
|
*":$PNPM_HOME:"*) ;;
|
|
*) export PATH="$PNPM_HOME:$PATH" ;;
|
|
esac
|
|
# pnpm end
|