Only consider regular files for the '[noperm]'

Recently, NERDTree added the &readonly setting to its buffer.
Unfortunately, this caused airline to render the '[noperm]' string in
it.

Fix this by only making the readonly check for buffers that actually
represent files (e.g. the buftype option is empty).
This commit is contained in:
Christian Brabandt 2018-05-11 09:50:13 +02:00
parent 5a065e8b82
commit c7e05efb76
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -86,6 +86,11 @@ function! airline#parts#iminsert()
endfunction endfunction
function! airline#parts#readonly() function! airline#parts#readonly()
" only consider regular buffers (e.g. ones that represent actual files,
" but not special ones like e.g. NERDTree)
if !empty(&buftype)
return ''
endif
if &readonly && !filereadable(bufname('%')) if &readonly && !filereadable(bufname('%'))
return '[noperm]' return '[noperm]'
else else