Advertisement
Rapptz

.bashrc

Sep 29th, 2013
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.29 KB | None | 0 0
  1. # If not running interactively, don't do anything
  2. [[ $- != *i* ]] && return
  3.  
  4. # Bash prompt
  5. export PS1='\[\033[0;36m\]\W\[\033[0;32m\]$(__git_ps1 " (%s)") \[\033[0;34m\]>\[\033[0m\] '
  6.  
  7. ### Autocomplete {{{
  8.     if [ -f /etc/bash_completion ]; then
  9.         . /etc/bash_completion
  10.     fi
  11.  
  12.     # Autocomplete for SSH
  13.     if [ -f $HOME/.ssh/known_hosts ]; then
  14.         SSH_COMPLETE=( $(cut -d , -f 1 $HOME/.ssh/known_hosts | cut -f1 -d ' ' | uniq) )
  15.         complete -o default -W '${SSH_COMPLETE[*]}' ssh
  16.         complete -o default -W '${SSH_COMPLETE[*]}' scp
  17.     fi
  18.  
  19.     complete -cf sudo man type
  20.     bind "set completion-ignore-case on"
  21. ### }}}
  22.  
  23. # Environment variables
  24. export LANG=en_US.UTF-8
  25.  
  26. # History
  27. export HISTSIZE="10000"
  28. export HISTFILESIZE="10000"
  29. export HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups  # don't duplicate
  30. shopt -s histappend                                        # append, not write
  31.  
  32. ### Functions {{{
  33.     # Calculator, math 100/2*10 {{{
  34.     function math() {
  35.         echo "scale=2 ; $*" | sed -e "s:x:*:g" | sed -e "s:,::g" | bc
  36.     }
  37.  
  38.     # Preserve environment when doing "sudo vim [..]"
  39.     function sudo() {
  40.         case $* in
  41.             vim* ) shift 1; command sudo -E vim "$@" ;;
  42.             * ) command sudo "$@" ;;
  43.         esac
  44.     }
  45. ### }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement