dotfiles/.zshrc

83 lines
1.4 KiB
Bash
Raw Normal View History

2018-06-22 23:39:11 -07:00
local oh_my_zsh="$HOME/.oh-my-zsh"
2017-09-28 10:22:57 -07:00
2018-06-22 23:39:11 -07:00
if [[ -d "$oh_my_zsh" ]]; then
local theme="jispwoso"
export ZSH="$oh_my_zsh"
export ZSH_THEME="$theme"
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
if [[ -d "$DEVPATH/android/android-sdk" ]]; then
2018-02-14 19:24:55 -07:00
export ANDROID_SDK="$DEVPATH/android/android-sdk"
2017-09-28 10:22:57 -07:00
fi
if [[ -d "$DEVPATH/android/android-ndk" ]]; then
2018-02-14 19:24:55 -07:00
export ANDROID_NDK="$DEVPATH/android/android-ndk"
2017-09-28 10:22:57 -07:00
fi
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-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
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
loc="Lake Forest, CA"
fi
curl -sSL "wttr.in/$loc?m"
}
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"