commit a3aa2f6113248a88b04ca51394034c2f90f0467a
parent 88c1f35f082c51c1f4aacd214ea3ce9f2912c9d5
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Tue, 21 May 2019 15:29:44 +0200
vim: only check indent/trailing space where appropriate
Former-commit-id: 6d8e52f62379745f80a5f658e8f40f6a95d51616
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/vim/general.vimrc b/vim/general.vimrc
@@ -105,6 +105,10 @@ augroup END
" return '[mixed-indenting]' if spaces and tabs are used to indent
" return an empty string if everything is fine
function! StatuslineTabWarning()
+ if &readonly || &bt == "nofile"
+ return ""
+ endif
+
if !exists("b:statusline_tab_warning")
let tabs = search('^\t', 'nw') != 0
let spaces = search('^ ', 'nw') != 0
@@ -123,6 +127,10 @@ endfunction
" return '[\s]' if trailing white space is detected
" return '' otherwise
function! StatuslineTrailingSpaceWarning()
+ if &readonly || &bt == "nofile"
+ return ""
+ endif
+
if !exists("b:statusline_trailing_space_warning")
if search('\s\+$', 'nw') != 0
let b:statusline_trailing_space_warning = '[\s]'