dotfiles/.zshrc

94 lines
1.5 KiB
Bash
Raw Normal View History

2018-06-22 23:39:11 -07:00
local oh_my_zsh="$HOME/.oh-my-zsh"
2018-11-21 17:51:14 -07:00
source $HOME/.ssh-sentinel
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
local theme="jispwoso"
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"
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
export USER=$(whoami)
fi
2017-09-28 10:22:57 -07:00
which go &> /dev/null
2017-10-19 22:54:42 -07:00
if (( !$? )) && [[ -d "$DEVPATH/go" ]]; then
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
2019-11-14 22:18:23 -07:00
which rbenv &> /dev/null
if (( !$? )); then
eval "$(rbenv init -)"
2019-09-11 07:00:14 -07:00
fi
2018-06-22 23:39:11 -07:00
which nvim &> /dev/null
neovim="$?"
which vim &> /dev/null
vim="$?"
if (( !$neovim )); then
export EDITOR="nvim"
elif (( !$vim )); then
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
}
2017-10-31 16:54:09 -07:00
alias e="$EDITOR"
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"