nvim: plugin: statusline: Show read only or modified status
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
fd5c5b15f5
commit
3b7326b6ed
1 changed files with 16 additions and 0 deletions
|
@ -19,9 +19,24 @@ function! GetCursorPosition()
|
||||||
\ : ''
|
\ : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! GetFileStatus()
|
||||||
|
if &buftype != ''
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:file = expand('%:p')
|
||||||
|
let l:status =
|
||||||
|
\ (&readonly || (filereadable(l:file) && !filewritable(l:file))
|
||||||
|
\ ? 'R'
|
||||||
|
\ : '')
|
||||||
|
\ . (&modified ? '+m' : '')
|
||||||
|
return len(l:status) > 0 ? ' ' . l:status : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ActiveStatus() abort
|
function! ActiveStatus() abort
|
||||||
let statusline=""
|
let statusline=""
|
||||||
let statusline.="%1*\ %{winnr()}\ "
|
let statusline.="%1*\ %{winnr()}\ "
|
||||||
|
let statusline.="%4*\ %{GetFileStatus()}"
|
||||||
let statusline.="%2*\ %Y\ "
|
let statusline.="%2*\ %Y\ "
|
||||||
let statusline.="%3*%<%f"
|
let statusline.="%3*%<%f"
|
||||||
let statusline.="%="
|
let statusline.="%="
|
||||||
|
@ -32,6 +47,7 @@ endfunction
|
||||||
function! PassiveStatus() abort
|
function! PassiveStatus() abort
|
||||||
let statusline=""
|
let statusline=""
|
||||||
let statusline.="%5*\ %{winnr()}\ "
|
let statusline.="%5*\ %{winnr()}\ "
|
||||||
|
let statusline.="%8*\ %{GetFileStatus()}"
|
||||||
let statusline.="%6*\ %Y\ "
|
let statusline.="%6*\ %Y\ "
|
||||||
let statusline.="%7*%<%f"
|
let statusline.="%7*%<%f"
|
||||||
let statusline.="%="
|
let statusline.="%="
|
||||||
|
|
Loading…
Reference in a new issue