dotfiles/.zshrc

108 lines
2.1 KiB
Bash
Raw Normal View History

2020-02-24 06:35:20 -07:00
oh_my_zsh="$HOME/.oh-my-zsh"
2017-09-28 10:22:57 -07:00
if [[ -f "$oh_my_zsh/oh-my-zsh.sh" ]]; then
2018-06-22 23:39:11 -07:00
export ZSH="$oh_my_zsh"
2020-05-21 19:23:23 -07:00
export DISABLE_AUTO_UPDATE=true
2020-10-03 12:57:02 -07:00
2020-02-24 18:06:39 -07:00
if (( !${+ZSH_THEME} )); then
2020-04-16 12:48:11 -07:00
export ZSH_THEME="simple"
2020-02-24 18:06:39 -07:00
fi
2020-04-16 12:17:32 -07:00
export plugins=(
2021-10-06 06:27:53 -07:00
themes
2020-04-16 12:17:32 -07:00
fzf
git
)
2021-10-06 06:23:16 -07:00
if [[ $(command -v tmux) ]]; then
if [[ ! -v "ZSH_TMUX_AUTOSTART" ]]; then export ZSH_TMUX_AUTOSTART=true; fi
plugins+=(tmux)
fi
2021-10-06 06:19:38 -07:00
if [[ $(command -v systemctl) ]]; then
plugins+=(systemd)
fi
2018-06-22 23:39:11 -07:00
source "$oh_my_zsh/oh-my-zsh.sh"
2017-09-28 10:22:57 -07:00
fi
2021-07-22 05:39:26 -07:00
if [[ -d "$HOME/workspace" ]]; then
2020-02-24 06:35:55 -07:00
export DEVPATH="$HOME/workspace"
2017-12-15 15:02:16 -07:00
else
2021-07-22 05:39:26 -07:00
mkdir -p "$HOME/devel"
export DEVPATH="$HOME/devel"
2017-09-28 10:22:57 -07:00
fi
2018-10-30 22:47:13 -07:00
if [[ -z "$USER" ]]; then
2020-02-24 06:36:26 -07:00
USER=$(whoami)
export USER
2018-10-30 22:47:13 -07:00
fi
2020-12-09 16:49:45 -07:00
if [[ $(command -v go) ]]; then
2017-10-19 22:54:42 -07:00
export GOPATH="$DEVPATH/go"
2017-12-21 19:15:57 -07:00
export PATH="$GOPATH/bin:$PATH"
2017-09-28 10:22:57 -07:00
fi
2018-11-29 23:13:04 -07:00
if [[ -d "$HOME/.cargo" ]]; then
export PATH=$HOME/.cargo/bin:$PATH
fi
2020-02-24 06:37:23 -07:00
if [[ -d "$HOME/.rbenv" ]]; then
export PATH="$HOME/.rbenv/bin:$PATH"
2019-11-14 22:18:23 -07:00
eval "$(rbenv init -)"
2019-09-11 07:00:14 -07:00
fi
2020-10-03 12:58:59 -07:00
if [[ -d "$HOME/.nvm" ]]; then
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
2022-04-21 21:12:03 -07:00
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
2020-10-03 12:58:59 -07:00
fi
2020-02-24 06:36:58 -07:00
if [[ $(command -v nvim) ]]; then
2018-06-22 23:39:11 -07:00
export EDITOR="nvim"
2020-02-24 06:36:58 -07:00
elif [ $(command -v vim) ]; then
2018-06-22 23:39:11 -07:00
export EDITOR="vim"
else
export EDITOR="vi"
fi
2020-10-06 09:29:38 -07:00
if [[ $(command -v uname) ]] && uname -r | grep -iq microsoft-standard; then source "$HOME/.wsl.zsh"; fi
2020-10-05 07:13:53 -07:00
2020-12-23 16:17:23 -07:00
if [[ -f "$HOME/.work.zsh" ]]; then source "$HOME/.work.zsh"; fi
2019-10-02 07:52:33 -07:00
if [[ $(command -v fzf) && $(command -v fd) ]]; then
export FZF_DEFAULT_COMMAND="fd --type f --hidden --no-ignore --follow --exclude .git"
fi
2021-08-09 18:36:54 -07:00
mkdir -p "$HOME/.local/bin" && export PATH="$HOME/.local/bin:$PATH"
2018-02-17 12:01:17 -07:00
function weather() {
2018-06-22 23:39:11 -07:00
local loc=$1
2018-02-17 12:01:17 -07:00
if [[ -z "$loc" ]]; then
2019-05-01 22:01:50 -07:00
loc="Phoenix, AZ"
2018-02-17 12:01:17 -07:00
fi
2019-05-01 22:01:50 -07:00
curl -sSL "wttr.in/$loc?"
2018-02-17 12:01:17 -07:00
}
2021-12-20 06:18:14 -07:00
function proj {
local proj="$1"
if [[ ! -d "$DEVPATH/$proj" ]]; then echo "Unknown project $proj"; return; fi
cd "$DEVPATH/$proj"
}
2020-02-24 06:36:58 -07:00
alias e='$EDITOR'
2017-10-31 16:54:09 -07:00
alias s="du -sh"
alias sd="du -hd 1"
2017-09-28 10:22:57 -07:00
2018-02-17 12:01:17 -07:00
alias tmux="tmux -2"
2017-09-28 10:22:57 -07:00
alias l="ls -lah"
alias ll="ls -lh"
alias la="ls -lah"
2020-12-29 23:33:13 -07:00
alias hexenc="hexdump -e '1/1 \"%02x\"'"