From 0485b48dbb9b59e01a845c052c869c49cdbe844f Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 24 Feb 2016 20:40:29 +0100 Subject: [PATCH] Display [noperm] with modifiable, but not readable buffers Based on: https://github.com/vim-airline/vim-airline/issues/633#issuecomment-174504456 Fixes: https://github.com/vim-airline/vim-airline/issues/633. --- autoload/airline/parts.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/airline/parts.vim b/autoload/airline/parts.vim index cd0a5c6..cc003ae 100644 --- a/autoload/airline/parts.vim +++ b/autoload/airline/parts.vim @@ -70,7 +70,12 @@ function! airline#parts#iminsert() endfunction function! airline#parts#readonly() - return &readonly ? g:airline_symbols.readonly : '' + let buffer=winbufnr('') + if &readonly && &modifiable && !filereadable(buffer) + return '[noperm]' + else + return &readonly ? g:airline_symbols.readonly : '' + endif endfunction function! airline#parts#filetype()