Skip to content

Instantly share code, notes, and snippets.

@brycemcd
Created July 15, 2014 14:25
Show Gist options
  • Save brycemcd/9c711723dd3d3f88a648 to your computer and use it in GitHub Desktop.
Save brycemcd/9c711723dd3d3f88a648 to your computer and use it in GitHub Desktop.
Adds # of lines changed to vim statusline
" NOTE: currently appends a "^@" to the end of the line and I haven't
" taken the time to get rid of that
function! LinesChanged()
let dif=system('git diff --stat -- '. bufname('%') .'| cut -d"|" -f2 | head -n 1')
return dif
endfunction
" statusbar:
set statusline= " clear the line
set statusline+=Buf:#%n\ %f\ %m\ %r
set statusline+=\ Line:%l/%L\ [%p%%]
set statusline+=\ Col:%c
set statusline+=%= " move to the right
set statusline+=\ %{LinesChanged()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment