+ " Display unexpected 'fileformat' and 'fileencoding' settings.
+ function! s:StatuslineFileFormat()
+ if &fileformat != 'unix'
+ return '[' . &fileformat . ']'
+ else
+ return ''
+ endif
+ endfunction
+ function! s:StatuslineFileEncoding()
+ if &fileencoding != '' && &fileencoding != 'utf-8'
+ \ && &filetype != 'help'
+ return '[' . &fileencoding . ']'
+ else
+ return ''
+ endif
+ endfunction
+
+ " Return current syntax group in brackets or nothing if there's none.
+ function! s:StatuslineSyntaxGroup()
+ let l:group = synIDattr(synID(line('.'), col('.'), 1), 'name')
+ if l:group != ''
+ return '[' . l:group . '] '
+ else
+ return ''
+ endif
+ endfunction
+
+ " Short function names to make 'statusline' more readable.
+ function! SBC()
+ return <SID>StatuslineBufferCount()
+ endfunction
+ function! SRF()
+ return <SID>StatuslineRelativeFilename()
+ endfunction
+ function! SFF()
+ return <SID>StatuslineFileFormat()
+ endfunction
+ function! SFE()
+ return <SID>StatuslineFileEncoding()
+ endfunction
+ function! SSG()
+ return <SID>StatuslineSyntaxGroup()
+ endfunction
+