jackwilder

Powerline Bashrc

Mar 4th, 2016
1,015
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     # .bashrc
  2.      
  3.     if [[ "$(uname)" != "Darwin" ]]; then # non mac os x
  4.      
  5.         # source global bashrc
  6.         if [[ -f "/etc/bashrc" ]]; then
  7.             . /etc/bashrc
  8.         fi
  9.      
  10.         export TERM='xterm-256color' # probably shouldn't do this
  11.     fi
  12.      
  13.     # bash prompt with colors
  14.     # [ <user>@<hostname> <working directory> {current git branch (if you're in a repo)} ]
  15.     # ==>
  16.     PS1="\[\e[1;33m\][ \u\[\e[1;37m\]@\[\e[1;32m\]\h\[\e[1;33m\] \W\$(git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/ {\[\e[1;36m\]\1\[\e[1;33m\]}/') ]\[\e[0m\]\n==> "
  17.      
  18.     # execute only in Mac OS X
  19.     if [[ "$(uname)" == 'Darwin' ]]; then
  20.      
  21.         # if OS X has a $HOME/bin folder, then add it to PATH
  22.         if [[ -d "$HOME/bin" ]]; then
  23.             export PATH="$PATH:$HOME/bin"
  24.         fi
  25.      
  26.         alias ls='ls -G' # ls with colors
  27.      
  28.     fi
  29.      
  30.     alias ll='ls -lah' # long listing of all files with human readable file sizes
  31.     alias tree='tree -C' # turns on coloring for tree command
  32.     alias mkdir='mkdir -p' # create parent directories as needed
  33.     alias vim='vim -p' # if more than one file, open files in tabs
  34.      
  35.     export EDITOR='vim'
  36.     function _update_ps1()
  37.     {
  38.        export PS1="$(~/powerline-shell.py $?)"
  39.     }
  40.      
  41.     export PROMPT_COMMAND="_update_ps1"
  42.  
  43. # aliases #############################################
  44.  
  45. # enable color support of ls and also add handy aliases
  46. eval `dircolors -b`
  47. alias ls='ls --color=auto'
  48. alias dir='ls --color=auto --format=vertical'
  49. alias vdir='ls --color=auto --format=long'
  50.  
  51. # some more ls aliases
  52. alias ll='ls -lhX'
  53. alias la='ls -A'
  54. alias ldir='ls -lhA |grep ^d'
  55. alias lfiles='ls -lhA |grep ^-'
  56. #alias l='ls -CF'
  57.  
  58. # To see something coming into ls output: lss
  59. alias lss='ls -lrt | grep $1'
  60.  
  61. # To check a process is running in a box with a heavy load: pss
  62. alias pss='ps -ef | grep $1'
  63.  
  64. # usefull alias to browse your filesystem for heavy usage quickly
  65. alias ducks='ls -A | grep -v -e '\''^\.\.$'\'' |xargs -i du -ks {} |sort -rn |head -16 | awk '\''{print $2}'\'' | xargs -i du -hs {}'
  66.  
  67. # cool colors for manpages
  68. alias man="TERMINFO=~/.terminfo TERM=mostlike LESS=C PAGER=less man"
  69.  
  70. ##########################################################
  71. # enable programmable completion features (you don't need to enable
  72. # this, if it's already enabled in /etc/bash.bashrc).
  73. if [ -f /etc/bash_completion ]; then
  74.    . /etc/bash_completion
  75. fi
RAW Paste Data