Skip to content

Instantly share code, notes, and snippets.

@fberger
Last active February 12, 2020 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fberger/543163 to your computer and use it in GitHub Desktop.
Save fberger/543163 to your computer and use it in GitHub Desktop.
.bashrc
# don't put duplicate lines in the history. See bash(1) for more options
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoredups:ignoreboth:ingorespace
export HISTFILESIZE=100000
export HISTSIZE=10000
# have shells append to your history
shopt -s histappend
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
PS1='\u@\h:\w\$ '
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
export EDITOR=emacsclient
alias chainsaw="javaws http://logging.apache.org/log4j/docs/webstart/chainsaw/chainsawWebStart.jnlp"
alias psg="ps ax | grep"
alias less='less -i'
# allow local x server access
xhost + local:
# emacs' grep-find excluding svn directories
alias grep-find='find . -not -path "*svn*" -type f -print0 | xargs -0 -e grep -n -e '
# invoke ivy with published dependencies
alias ant-ivy='ant -Divy.dependencies.published=true'
# show git branch in prompt
prompt_command() {
# Send notification for long running commands taking longer than 30 seconds.
if (($(date +%s) - $start_time > 30)); then
notify-send -t 1500 "Done: $current $diff_time";
play -q /usr/share/sounds/Kopete_Event.ogg
fi
path=$(pwd)
if [[ $path == '/home/fberger/git/'* ]]; then
branch=$(git branch | grep \* | awk '{print $2}')
PS1='\u@\h:\w[${branch}]\$ '
else
PS1='\u@\h:\w\$ '
fi
}
export PROMPT_COMMAND='prompt_command;history -a'
function capture_previous_command {
ignored="prompt_command history -a"
if [[ ! $ignored =~ $BASH_COMMAND ]]; then
previous=$current
current=$BASH_COMMAND;
$start_time=$(date +%s)
fi
}
trap capture_previous_command DEBUG
alias d='notify-send -t 10000 "Done: $previous";play -q /usr/share/sounds/Kopete_Event.ogg'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment