2016-01-06 11:55:04 -06:00
|
|
|
export DOTFILES_PATH=$HOME/.dotfiles
|
|
|
|
|
|
|
|
BASE16_SHELL="$DOTFILES_PATH/colors/shell"
|
|
|
|
[[ -s "$BASE16_SHELL" ]] && source "$BASE16_SHELL"
|
|
|
|
|
2016-07-14 15:22:19 -05:00
|
|
|
if [ -t 0 ]; then
|
2016-07-15 12:17:12 -05:00
|
|
|
source "$DOTFILES_PATH/variables.bash"
|
|
|
|
|
2016-07-14 15:22:19 -05:00
|
|
|
# disable ctrl-s terminal freeze
|
|
|
|
[[ $- == *i* ]] && stty -ixon
|
|
|
|
|
|
|
|
# filesystem aliases
|
|
|
|
alias lx='ls -lXB' # order by filetype
|
|
|
|
alias lk='ls -lSr' # order by filesize reversed
|
|
|
|
alias lt='ls -ltr' # order by file modified time
|
|
|
|
alias lc='ls -ltcr' # order by filectime
|
|
|
|
alias lu='ls -ltur' # order by file access time
|
|
|
|
alias ls='ls -h --color --group-directories-first' # flat view w/ directories first
|
|
|
|
alias l='ls -h --color --group-directories-first' # same as above
|
|
|
|
alias ll='ls -lv --group-directories-first' # non-flat view
|
|
|
|
alias lm='ll | more'
|
|
|
|
alias lr='ll -R' # please don't
|
|
|
|
alias la='ll -A' # show all
|
|
|
|
alias tree='tree -Csuh'
|
|
|
|
|
|
|
|
# navigation aliases
|
2016-08-21 09:45:55 -05:00
|
|
|
alias c="cd $HOME/.."
|
2016-07-14 15:22:19 -05:00
|
|
|
alias cd..="cd .."
|
2016-08-30 17:14:27 -05:00
|
|
|
alias cdd="cd \"$DOTFILES_PATH\""
|
2016-07-14 15:22:19 -05:00
|
|
|
alias ..="cd .."
|
|
|
|
alias ...="cd ../.."
|
|
|
|
alias ....="cd ../../.."
|
|
|
|
alias .....="cd ../../../.."
|
|
|
|
alias ......="cd ../../../../.."
|
2016-09-24 05:36:01 -05:00
|
|
|
alias todo="todo.sh"
|
2016-09-24 06:25:35 -05:00
|
|
|
alias td="todo"
|
2016-07-14 15:22:19 -05:00
|
|
|
|
|
|
|
# tmux aliases
|
|
|
|
alias tmux='TERM=screen-256color-bce tmux' # syntax higlighting for vim in tmux
|
|
|
|
alias tmnew="tmux new -s"
|
|
|
|
alias tmls="tmux list-sessions"
|
|
|
|
alias tmatt="tmux attach -t"
|
|
|
|
|
|
|
|
# git aliases
|
|
|
|
alias gs="git status"
|
|
|
|
alias gl="git log"
|
|
|
|
alias gpl="git pull"
|
|
|
|
alias gp="git push"
|
|
|
|
alias gac="git add -A && git commit -m"
|
|
|
|
|
2016-07-29 13:59:10 -05:00
|
|
|
# browser aliases
|
|
|
|
alias qutebrowser="qutebrowser --backend webengine"
|
|
|
|
|
2016-07-14 15:22:19 -05:00
|
|
|
# networking aliases
|
|
|
|
alias p="ping 8.8.8.8"
|
2016-08-30 17:14:27 -05:00
|
|
|
alias wifi-menu="sudo wifi-menu"
|
2016-07-29 13:59:10 -05:00
|
|
|
alias wifi="sudo systemctl start netctl-auto@$(for wli in /sys/class/net/wl*; do echo $(basename $wli); break; done)"
|
2016-07-14 15:22:19 -05:00
|
|
|
|
|
|
|
# emacs aliases
|
|
|
|
alias emacs="emacs -nw"
|
|
|
|
|
|
|
|
# arch aliases
|
|
|
|
alias archupdate="pacaur -Syyu --noconfirm --noedit"
|
|
|
|
|
2016-08-12 06:01:46 -05:00
|
|
|
# misc aliases
|
|
|
|
alias setbg="feh --bg-fill"
|
|
|
|
|
2016-07-31 21:07:59 -05:00
|
|
|
# games aliases
|
|
|
|
# alias steam="LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' steam"
|
|
|
|
|
2016-07-15 12:17:12 -05:00
|
|
|
stopbar() {
|
|
|
|
if [[ -f "$BAR_PID_FILE" ]]; then
|
2016-07-27 08:57:56 -05:00
|
|
|
echo
|
2016-07-15 12:17:12 -05:00
|
|
|
kill -SIGINT $(cat "$BAR_PID_FILE")
|
|
|
|
rm -f "$BAR_PID_FILE"
|
|
|
|
else
|
|
|
|
echo "Bar is not running."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
export -f stopbar
|
2016-07-14 15:22:19 -05:00
|
|
|
|
2016-07-27 08:57:56 -05:00
|
|
|
# wm aliases
|
|
|
|
startbar() {
|
|
|
|
if [[ -f "$BAR_PID_FILE" ]]; then
|
|
|
|
stopbar
|
|
|
|
fi
|
2016-07-29 13:59:10 -05:00
|
|
|
"$BAR_PATH/start.bash"
|
2016-07-27 08:57:56 -05:00
|
|
|
echo $! > "$BAR_PID_FILE"
|
|
|
|
bg
|
|
|
|
disown
|
|
|
|
}
|
|
|
|
export -f startbar
|
|
|
|
|
2016-07-15 11:13:29 -05:00
|
|
|
# misc aliases
|
|
|
|
alias keyrepeat="xset r rate 250 80"
|
|
|
|
|
2016-07-14 15:22:19 -05:00
|
|
|
export EDITOR="vim"
|
|
|
|
if command -v nvim >/dev/null 2>&1; then
|
|
|
|
alias vim="nvim"
|
|
|
|
alias ovim="\\vim"
|
|
|
|
export EDITOR="nvim"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# prompt
|
|
|
|
COLOR_RESET='\[\e[0m\]'
|
|
|
|
PROMPT_SUCCESS_COLOR='\[\e[0;34m\]'
|
|
|
|
PROMPT_FAILURE_COLOR='\[\e[0;31m\]'
|
|
|
|
DIR_COLOR='\[\e[0;33m\]'
|
2016-07-15 11:13:29 -05:00
|
|
|
# prompt rendering functions
|
2016-07-14 15:22:19 -05:00
|
|
|
sps() {
|
|
|
|
name="$PWD"
|
|
|
|
[[ "$name" =~ ^"$HOME"(/|$) ]] && name="~${name#$HOME}"
|
|
|
|
curdir=$(echo "$PWD" | sed -r 's|.*/(.+)$|\1|g')
|
|
|
|
name=$(echo "$name" | sed -r 's|/(..)[^/]*|/\1|g' | sed -r 's|(.*/)(.+)$|\1|g')
|
|
|
|
[[ "$name" == "~" ]] && curdir=""
|
|
|
|
echo "$name$curdir"
|
|
|
|
}
|
|
|
|
prompt_command_func()
|
|
|
|
{
|
|
|
|
RET=$?
|
|
|
|
if [ $RET -eq 0 ]; then
|
|
|
|
STATUS_COLOR=$PROMPT_SUCCESS_COLOR
|
|
|
|
else
|
|
|
|
STATUS_COLOR=$PROMPT_FAILURE_COLOR
|
|
|
|
fi;
|
|
|
|
PS1="$STATUS_COLOR\u@\h$COLOR_RESET $DIR_COLOR$(eval "sps")$COLOR_RESET "
|
|
|
|
}
|
|
|
|
export PROMPT_COMMAND="prompt_command_func"
|
|
|
|
|
|
|
|
# man pages with vim
|
|
|
|
vman() {
|
2016-07-19 13:25:54 -05:00
|
|
|
if command -v nvim >/dev/null 2>&1; then
|
|
|
|
nvim -c "SuperMan $*"
|
|
|
|
else
|
|
|
|
vim -c "SuperMan $*"
|
|
|
|
fi
|
2016-07-14 15:22:19 -05:00
|
|
|
|
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo "No manual entry for $*"
|
|
|
|
fi
|
|
|
|
}
|
2016-07-19 13:25:54 -05:00
|
|
|
alias _man="\\man"
|
2016-07-14 15:22:19 -05:00
|
|
|
alias man="vman"
|
|
|
|
|
2016-07-15 11:13:29 -05:00
|
|
|
# save the current directory for later retrieval
|
|
|
|
scwd() {
|
|
|
|
addon=""
|
|
|
|
if [[ -n $1 ]]; then
|
|
|
|
addon="-$1"
|
|
|
|
fi
|
2016-07-29 11:23:51 -05:00
|
|
|
echo "$PWD" > "$DOTFILES_PATH/env/sh/cwd$addon.tmp"
|
2016-07-15 11:13:29 -05:00
|
|
|
}
|
|
|
|
export -f scwd
|
2016-07-15 12:20:05 -05:00
|
|
|
bind '"\C-s"':"\"scwd\C-m\""
|
2016-07-15 11:13:29 -05:00
|
|
|
|
|
|
|
# go to the saved current directory
|
|
|
|
gcwd() {
|
|
|
|
addon=""
|
|
|
|
if [[ -n $1 ]]; then
|
|
|
|
addon="-$1"
|
|
|
|
fi
|
2016-07-29 13:59:10 -05:00
|
|
|
cd $(cat "$DOTFILES_PATH/env/sh/cwd$addon.tmp")
|
2016-07-15 11:13:29 -05:00
|
|
|
}
|
|
|
|
export -f gcwd
|
|
|
|
bind '"\C-g"':"\"gcwd\C-m\""
|
|
|
|
|
2016-07-14 15:22:19 -05:00
|
|
|
complete -cf sudo
|
|
|
|
complete -cf man
|
|
|
|
|
|
|
|
# allow a per-device script that is pulled in
|
|
|
|
if [ -a "$HOME/.bashrc_env" ]; then
|
|
|
|
. "$HOME/.bashrc_env"
|
|
|
|
fi
|
2016-08-30 17:14:27 -05:00
|
|
|
|
2016-09-12 23:58:01 -05:00
|
|
|
if [ "$PWD" = "$HOME" ]; then
|
|
|
|
cd "$HOME/.."
|
|
|
|
fi
|
2016-09-20 03:07:33 -05:00
|
|
|
|
2016-11-21 16:17:11 -06:00
|
|
|
shopt -s histverify
|
|
|
|
|
2016-09-20 03:07:33 -05:00
|
|
|
# except we still want some things to work the old fashioned way
|
2016-09-24 06:25:35 -05:00
|
|
|
bind -f "$HOME/.inputrc"
|
2016-01-06 11:55:04 -06:00
|
|
|
fi
|