2020-02-24 06:35:20 -07:00
|
|
|
oh_my_zsh="$HOME/.oh-my-zsh"
|
2017-09-28 10:22:57 -07:00
|
|
|
|
2019-10-02 08:10:25 -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
|
|
|
git
|
2022-10-03 06:58:16 -07:00
|
|
|
urltools
|
2023-03-03 16:58:25 -07:00
|
|
|
asdf
|
2020-04-16 12:17:32 -07:00
|
|
|
)
|
|
|
|
|
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
|
|
|
|
|
2022-10-03 06:52:23 -07:00
|
|
|
if [[ $(command -v fzf) ]]; then plugins+=(fzf); fi
|
2021-10-06 06:23:16 -07:00
|
|
|
|
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: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
|
|
|
|
2020-04-16 13:50:57 -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"
|
|
|
|
|
2023-03-03 16:58:25 -07:00
|
|
|
function install_asdf_plugins() {
|
|
|
|
if [[ ! $(command -v asdf) ]]; then return; fi
|
|
|
|
|
|
|
|
local asdf_plugins=(ruby nodejs)
|
|
|
|
|
|
|
|
foreach plugin in $asdf_plugins; do
|
|
|
|
if [[ ! -d "$HOME/.asdf/plugins/$plugin" ]]; then
|
|
|
|
echo "Installing asdf $plugin plugin"
|
|
|
|
asdf plugin add $plugin https://github.com/asdf-vm/asdf-$plugin.git
|
|
|
|
asdf install $plugin latest
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
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
|
2022-12-23 06:53:13 -07:00
|
|
|
loc="Phoenix%2C%20Arizona%2C%20United%20States"
|
2018-02-17 12:01:17 -07:00
|
|
|
fi
|
|
|
|
|
2022-10-03 06:48:07 -07:00
|
|
|
curl -sSL "https://wttr.in/$loc?"
|
2018-02-17 12:01:17 -07:00
|
|
|
}
|
|
|
|
|
2022-12-23 07:03:05 -07:00
|
|
|
function p {
|
|
|
|
local project="$1"
|
2021-12-20 06:18:14 -07:00
|
|
|
|
2022-12-23 07:03:05 -07:00
|
|
|
if [[ ! -d "$DEVPATH/$project" ]]; then echo "Unknown project $project"; return; fi
|
2021-12-20 06:18:14 -07:00
|
|
|
|
2022-12-23 07:03:05 -07:00
|
|
|
cd "$DEVPATH/$project"
|
2021-12-20 06:18:14 -07:00
|
|
|
}
|
|
|
|
|
2022-12-23 07:15:48 -07:00
|
|
|
if [[ $(command -v fd) ]]; then
|
|
|
|
function _p {
|
2023-01-12 07:53:26 -07:00
|
|
|
compadd $(fd --no-ignore --max-depth=1 --type=d . $DEVPATH | xargs basename -a)
|
2022-12-23 07:15:48 -07:00
|
|
|
}
|
2022-12-23 07:03:30 -07:00
|
|
|
|
2022-12-23 07:15:48 -07:00
|
|
|
compdef _p p
|
|
|
|
fi
|
2022-12-23 07:03:30 -07:00
|
|
|
|
2020-02-24 06:36:58 -07:00
|
|
|
alias e='$EDITOR'
|
2017-10-31 16:54:09 -07:00
|
|
|
alias s="du -sh"
|
2022-10-03 06:23:27 -07:00
|
|
|
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\"'"
|
2023-03-03 16:58:25 -07:00
|
|
|
|
|
|
|
install_asdf_plugins
|