]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
vimrc: Display unexpected BOM in statusline.
authorSimon Ruderich <simon@ruderich.org>
Tue, 12 Feb 2013 21:53:03 +0000 (22:53 +0100)
committerSimon Ruderich <simon@ruderich.org>
Tue, 12 Feb 2013 21:53:03 +0000 (22:53 +0100)
vimrc

diff --git a/vimrc b/vimrc
index d0b437d402df4dd4b132664a0df4b7d3248bb42e..d0c490c2f187fc4cda6220a30161fdce94203599 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -388,7 +388,7 @@ if has('statusline')
         endif
     endfunction
 
-    " Display unexpected 'fileformat' and 'fileencoding' settings.
+    " Display unexpected 'fileformat', 'fileencoding' and 'bomb' settings.
     function! s:StatuslineFileFormat()
         if &fileformat != 'unix'
             return '[' . &fileformat . ']'
@@ -404,6 +404,13 @@ if has('statusline')
             return ''
         endif
     endfunction
+    function! s:StatuslineFileBOMB()
+        if exists('+bomb') && &bomb
+            return '[BOM]'
+        else
+            return ''
+        endif
+    endfunction
 
     " Return current syntax group in brackets or nothing if there's none.
     function! s:StatuslineSyntaxGroup()
@@ -428,6 +435,9 @@ if has('statusline')
     function! SFE()
         return s:StatuslineFileEncoding()
     endfunction
+    function! SFB()
+        return s:StatuslineFileBOMB()
+    endfunction
     function! SSG()
         return s:StatuslineSyntaxGroup()
     endfunction
@@ -452,6 +462,7 @@ if has('statusline')
         set statusline+=%#Error#      " display warnings
         set statusline+=%{SFF()}      "   - unexpected file format
         set statusline+=%{SFE()}      "   - unexpected file encoding
+        set statusline+=%{SFB()}      "   - unexpected file byte order mask
         set statusline+=%##           " continue with normal colors
     endif