Skip to content

Instantly share code, notes, and snippets.

@dubgeiser
Created April 2, 2012 11:16
Show Gist options
  • Select an option

  • Save dubgeiser/2282745 to your computer and use it in GitHub Desktop.

Select an option

Save dubgeiser/2282745 to your computer and use it in GitHub Desktop.
Get git branch in Vim
" @return string The git branch we're in, empty if none.
function! functions#git_branch()
return system("git branch 2>/dev/null | grep '^\*' | sed 's/^\* //'")
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment