nvim: statusline: Add a hunk summary to the status line
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
40bc178d32
commit
d879a43b48
1 changed files with 8 additions and 0 deletions
|
@ -50,10 +50,17 @@ function! GetFileDir()
|
||||||
return len(l:path) > 0 ? l:path : ''
|
return len(l:path) > 0 ? l:path : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Taken from gitgutter README
|
||||||
|
function! GitHunkStatus()
|
||||||
|
let [a,m,r] = GitGutterGetHunkSummary()
|
||||||
|
return printf('+%d ~%d -%d', a, m, r)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ActiveStatus() abort
|
function! ActiveStatus() abort
|
||||||
let statusline=""
|
let statusline=""
|
||||||
let statusline.="%1*\ %{winnr()}\ "
|
let statusline.="%1*\ %{winnr()}\ "
|
||||||
let statusline.="%2*\ %{GitInfo()}"
|
let statusline.="%2*\ %{GitInfo()}"
|
||||||
|
let statusline.="%4*\ %{GitHunkStatus()}"
|
||||||
let statusline.="%2*\ %Y\ "
|
let statusline.="%2*\ %Y\ "
|
||||||
let statusline.="%3*%<%{GetFileDir()}"
|
let statusline.="%3*%<%{GetFileDir()}"
|
||||||
let statusline.="%="
|
let statusline.="%="
|
||||||
|
@ -65,6 +72,7 @@ function! PassiveStatus() abort
|
||||||
let statusline=""
|
let statusline=""
|
||||||
let statusline.="%5*\ %{winnr()}\ "
|
let statusline.="%5*\ %{winnr()}\ "
|
||||||
let statusline.="%6*\ %{GitInfo()}"
|
let statusline.="%6*\ %{GitInfo()}"
|
||||||
|
let statusline.="%8*\ %{GitHunkStatus()}"
|
||||||
let statusline.="%6*\ %Y\ "
|
let statusline.="%6*\ %Y\ "
|
||||||
let statusline.="%7*%<%{GetFileDir()}"
|
let statusline.="%7*%<%{GetFileDir()}"
|
||||||
let statusline.="%="
|
let statusline.="%="
|
||||||
|
|
Loading…
Reference in a new issue