From 1b59ccf35f63d8db73424e6dae50bf6347fc343d Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Tue, 11 Nov 2014 21:01:06 +0000 Subject: [PATCH] Added bash rc/profile scripts. --- .bash_profile | 3 +++ .bashrc | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .bash_profile create mode 100644 .bashrc diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..1028aef --- /dev/null +++ b/.bash_profile @@ -0,0 +1,3 @@ +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..6cba3cd --- /dev/null +++ b/.bashrc @@ -0,0 +1,52 @@ +# The best editor +export EDITOR=vi + +# Update the path with local overrides +export PATH=/usr/local/bin:/usr/local/sbin:${PATH} + +# Large history buffer +export HISTSIZE=9999 +export HISTFILESIZE=9999 + +# A useful prompt +PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' + +# Avoid duplicates in the history... +export HISTCONTROL=ignoredups:erasedups + +# Append history entries... +shopt -s histappend + +# After each command, save and reload history +export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r" + +# Make OS X's 'top' behave like the GNU one +alias top='top -u' + +# Git aliases +alias githistory='git log --oneline --abbrev-commit --all --graph --decorate' +alias gitx='open -a GitX .' + +# Add bash completion for ssh: it tries to complete the host to which you +# want to connect from the list of the ones contained in ~/.ssh/known_hosts + +__ssh_known_hosts() { + if [[ -f ~/.ssh/known_hosts ]]; then + cut -d " " -f1 ~/.ssh/known_hosts | cut -d "," -f1 + fi +} + +_ssh() { + local cur known_hosts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + known_hosts="$(__ssh_known_hosts)" + + if [[ ! ${cur} == -* ]] ; then + COMPREPLY=( $(compgen -W "${known_hosts}" -- ${cur}) ) + return 0 + fi +} + +complete -o bashdefault -o default -o nospace -F _ssh ssh 2>/dev/null \ + || complete -o default -o nospace -F _ssh ssh