nvim: statusline: Add a hunk summary to the status line

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2020-04-24 20:35:31 +05:30
parent 40bc178d32
commit d879a43b48

View file

@ -50,10 +50,17 @@ function! GetFileDir()
return len(l:path) > 0 ? l:path : ''
endfunction
" Taken from gitgutter README
function! GitHunkStatus()
let [a,m,r] = GitGutterGetHunkSummary()
return printf('+%d ~%d -%d', a, m, r)
endfunction
function! ActiveStatus() abort
let statusline=""
let statusline.="%1*\ %{winnr()}\ "
let statusline.="%2*\ %{GitInfo()}"
let statusline.="%4*\ %{GitHunkStatus()}"
let statusline.="%2*\ %Y\ "
let statusline.="%3*%<%{GetFileDir()}"
let statusline.="%="
@ -65,6 +72,7 @@ function! PassiveStatus() abort
let statusline=""
let statusline.="%5*\ %{winnr()}\ "
let statusline.="%6*\ %{GitInfo()}"
let statusline.="%8*\ %{GitHunkStatus()}"
let statusline.="%6*\ %Y\ "
let statusline.="%7*%<%{GetFileDir()}"
let statusline.="%="