This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/sh/bashrc

104 lines
2.4 KiB
Bash
Raw Normal View History

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"
# disable ctrl-s terminal freeze
2016-01-19 01:20:43 -06:00
[[ $- == *i* ]] && stty -ixon
2016-01-06 11:55:04 -06:00
# filesystem aliases
2016-01-06 12:23:59 -06:00
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'
2016-01-06 11:55:04 -06:00
# navigation aliases
alias cd..="cd .."
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
# tmux aliases
2016-01-06 12:34:29 -06:00
alias tmux='TERM=screen-256color-bce tmux' # syntax higlighting for vim in tmux
2016-01-06 11:55:04 -06:00
alias tmnew="tmux new -s"
alias tmls="tmux list-sessions"
alias tmatt="tmux attach -t"
# git aliases
alias gs="git status"
2016-01-21 05:07:44 -06:00
alias gl="git log"
2016-01-06 11:55:04 -06:00
alias gpl="git pull"
alias gp="git push"
alias gac="git add -A && git commit -m"
# networking aliases
alias p="ping 8.8.8.8"
2016-01-19 01:20:43 -06:00
# emacs aliases
alias emacs="emacs -nw"
2016-04-20 16:09:02 -05:00
# arch aliases
alias archupdate="pacaur -Syyu --noconfirm --noedit"
2016-01-30 20:13:55 -06:00
export EDITOR="vim"
2016-01-06 11:55:04 -06:00
if command -v nvim >/dev/null 2>&1; then
alias vim="nvim"
2016-01-30 20:13:55 -06:00
alias ovim="\\vim"
export EDITOR="nvim"
2016-01-06 11:55:04 -06:00
fi
# prompt
2016-01-22 05:45:14 -06:00
COLOR_RESET='\[\e[0m\]'
PROMPT_SUCCESS_COLOR='\[\e[0;34m\]'
PROMPT_FAILURE_COLOR='\[\e[0;31m\]'
DIR_COLOR='\[\e[0;33m\]'
2016-03-03 13:09:37 -06: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"
}
2016-01-06 11:55:04 -06:00
prompt_command_func()
{
RET=$?
if [ $RET -eq 0 ]; then
STATUS_COLOR=$PROMPT_SUCCESS_COLOR
else
STATUS_COLOR=$PROMPT_FAILURE_COLOR
fi;
2016-03-03 13:09:37 -06:00
PS1="$STATUS_COLOR\u@\h$COLOR_RESET $DIR_COLOR$(eval "sps")$COLOR_RESET "
2016-01-06 11:55:04 -06:00
}
export PROMPT_COMMAND="prompt_command_func"
2016-01-07 01:18:47 -06:00
# man pages with vim
vman() {
vim -c "SuperMan $*"
if [ "$?" != "0" ]; then
echo "No manual entry for $*"
fi
}
alias _man="man"
alias man="vman"
2016-04-20 16:09:02 -05:00
complete -cf sudo
complete -cf man
2016-01-06 11:55:04 -06:00
# allow a per-device script that is pulled in
if [ -a "$HOME/.bashrc_env" ]; then
. "$HOME/.bashrc_env"
fi