100 lines
2.5 KiB
Bash
100 lines
2.5 KiB
Bash
# .rc
|
|
# vim: ft=zsh
|
|
# Generic interactive shell setup
|
|
# Eryn Wells <eryn@erynwells.me>
|
|
|
|
print_heading -l 1 'Initializing interactive shell'
|
|
|
|
print_info -l 2 'Creating aliases'
|
|
#alias j='jobs'
|
|
alias h='history'
|
|
alias df='df -h'
|
|
alias du='du -h'
|
|
alias v='vim'
|
|
|
|
binary_exists ledger && alias l='ledger'
|
|
|
|
alias chux='chmod u+x'
|
|
alias chuw='chmod u+w'
|
|
alias chur='chmod u+r'
|
|
alias cho="chown $USER"
|
|
|
|
alias today='date +%Y-%m-%d'
|
|
|
|
alias addkey="ssh-agent ~/.ssh/id_rsa"
|
|
|
|
alias pprint="python -c 'import sys,pprint; pprint.pprint(eval(sys.stdin.read()))'"
|
|
alias pprint-json="python -c 'import sys,json;print json.dumps(json.load(sys.stdin), indent=2)'"
|
|
|
|
function g
|
|
{
|
|
if [[ $# -gt 0 ]]; then
|
|
git $@
|
|
else
|
|
git status --short --branch
|
|
fi
|
|
return $?
|
|
}
|
|
|
|
|
|
print_info -l 2 "Sourcing ${SYS}-specific settings"
|
|
case $SYS in
|
|
darwin)
|
|
alias acls='command ls -le'
|
|
# These things might have been installed by Homebrew
|
|
binary_exists gdircolors && alias dircolors='gdircolors'
|
|
binary_exists gfind && alias find='gfind'
|
|
binary_exists gnuindent && alias indent='gnuindent'
|
|
;;
|
|
linux)
|
|
# iptables aliases
|
|
alias iptls='sudo iptables --line-numbers -nv -L'
|
|
alias ip6tls='sudo ip6tables --line-numbers -nv -L'
|
|
alias rlx="xrdb $HOME/.Xdefaults"
|
|
;;
|
|
*)
|
|
print_error "What system %Bis%b this, anyway?"
|
|
;;
|
|
esac
|
|
|
|
function {
|
|
local has_gnu_ls=1
|
|
local lsbin='ls'
|
|
local ls_options='--color=auto'
|
|
|
|
if binary_exists gls; then
|
|
lsbin='gls'
|
|
else
|
|
has_gnu_ls=0
|
|
ls_options='-G'
|
|
fi
|
|
|
|
print_info_sub -l 3 "Setting up ls: `which $lsbin`"
|
|
alias ls="$lsbin $ls_options"
|
|
alias la="$lsbin -A $ls_options"
|
|
alias ll="$lsbin -l $ls_options"
|
|
alias l.="$lsbin -d $ls_options .*"
|
|
|
|
if [[ $has_gnu_ls -eq 1 ]]; then
|
|
if [[ -e "$HOME/.dircolors/$SYS.cfg" ]]; then
|
|
dircolors="$HOME/.dircolors/$SYS.cfg"
|
|
else
|
|
dircolors="$HOME/.dircolors/default.cfg"
|
|
fi
|
|
print_info_sub -l 3 "Setting up dircolors: `basename $dircolors`"
|
|
eval `dircolors $dircolors`
|
|
fi
|
|
}
|
|
|
|
# NetHack options
|
|
# use color in the terminal
|
|
binary_exists nethack && export NETHACKOPTIONS="color"
|
|
|
|
# Default ledger file
|
|
[[ -e "$HOME/Documents/Financial/personal.ledger" ]] && \
|
|
LEDGER_FILE=$HOME/Documents/Financial/personal.ledger
|
|
|
|
if [ -e $HOME/.rc.local ]; then
|
|
print_info -l 2 'Sourcing local interactive shell setup'
|
|
source $HOME/.rc.local
|
|
fi
|