dotfiles/.zshrc

88 lines
1.5 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"
export ZSH_THEME="$theme"
2019-10-30 19:10:38 -07:00
export DISABLE_UPDATE_PROMPT=true
2017-09-28 10:22:57 -07:00
plugins=(git)
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
2017-12-15 15:02:16 -07:00
if [[ -d "$HOME/devel" ]]; then
export DEVPATH="$HOME/devel"
2020-02-24 06:35:55 -07:00
elif [[ -d "$HOME/workspace" ]]; then
export DEVPATH="$HOME/workspace"
2017-12-15 15:02:16 -07:00
else
export DEVPATH="$HOME"
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-02-24 06:36:58 -07:00
if [ $(command -v go) ] && [[ -d "$DEVPATH/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-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
2019-10-02 07:52:33 -07:00
if [[ -f "$HOME/work.zsh" ]]; then
source "$HOME/work.zsh"
fi
2017-09-28 10:22:57 -07:00
function passgen () {
2017-10-31 16:57:45 -07:00
local len="$1"
local lower="$2"
2017-09-28 10:22:57 -07:00
2017-12-27 16:40:08 -07:00
echo "$len" | grep -qE '^[0-9]+$'
2017-12-15 15:12:37 -07:00
if (( $? )); then
2017-09-28 10:22:57 -07:00
len=32
fi
2018-06-22 23:39:11 -07:00
local result=`cat /dev/urandom | base64 | tr -d "\n" | head -c "$len"`
2017-09-28 10:22:57 -07:00
if [[ "$lower" = "true" ]]; then
local tr1="[:upper:]"
local tr2="[:lower:]"
2018-06-22 23:39:11 -07:00
result=`echo "$result" | tr "$tr1" "$tr2"`
2017-09-28 10:22:57 -07:00
fi
2018-06-22 23:39:11 -07:00
echo -n "$result"
2017-09-28 10:22:57 -07:00
}
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
}
2020-02-24 06:36:58 -07:00
alias e='$EDITOR'
2017-10-31 16:54:09 -07:00
alias s="du -sh"
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"