Skip to content

Instantly share code, notes, and snippets.

@nychng
Created August 22, 2012 08:51
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 nychng/3423858 to your computer and use it in GitHub Desktop.
Save nychng/3423858 to your computer and use it in GitHub Desktop.
"Git branch
function! GitBranch()
let branch = system("git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* //'")
if branch != ''
return ' Git Branch: ' . substitute(branch, '\n', '', 'g')
en
return ''
endfunction
function! CurDir()
return substitute(getcwd(), '/Users/amir/', "~/", "g")
endfunction
function! HasPaste()
if &paste
return 'PASTE MODE '
en
return ''
endfunction
" Format the statusline
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L%{GitBranch()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment