Skip to content
Browse files

upgrade the statsline indent warning

now, when noexpandtab is set, it allows up to &ts spaces at the start of
the line... i.e. it allows alignment at the start of the line. This
should result in less false-positive [mixed-indenting] flags when using
tabs
  • Loading branch information...
1 parent 170fa17 commit 3ae194e88968b0a92f09e5a5871cbe0a884fcbe4 @scrooloose committed Jun 29, 2010
Showing with 13 additions and 3 deletions.
  1. +13 −3 vimrc
View
16 vimrc
@@ -98,12 +98,22 @@ function! StatuslineTabWarning()
let tabs = search('^\t', 'nw') != 0
let spaces = search('^ ', 'nw') != 0
+ let b:statusline_tab_warning = ''
+
if tabs && spaces
- let b:statusline_tab_warning = '[mixed-indenting]'
+
+ if &et
+ let b:statusline_tab_warning = '[mixed-indenting]'
+ else
+ "if using tabs, allow alignment at the start of the line
+ "of up to one &ts width
+ if search('^ \{' . &ts . ',}', 'nw') != 0
+ let b:statusline_tab_warning = '[mixed-indenting]'
+ endif
+ endif
+
elseif (spaces && !&et) || (tabs && &et)
let b:statusline_tab_warning = '[&et]'
- else
- let b:statusline_tab_warning = ''
endif
endif
return b:statusline_tab_warning

0 comments on commit 3ae194e

Please sign in to comment.
Something went wrong with that request. Please try again.