X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=vimrc;h=8a6e07f4dc7ecf25224bc5ea4533232b881ddc76;hb=7727a2cd7afa1aae4770bef7e38fc7521ffb9ed4;hp=5141f596c77e83b5e5cfcf74868df93aac3bdb98;hpb=95544c8b2416ea178887ea7aed81eaedbb1835f5;p=config%2Fdotfiles.git diff --git a/vimrc b/vimrc index 5141f59..8a6e07f 100644 --- a/vimrc +++ b/vimrc @@ -387,6 +387,23 @@ if has('statusline') endif endfunction + " 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') @@ -404,6 +421,12 @@ if has('statusline') function! SRF() return StatuslineRelativeFilename() endfunction + function! SFF() + return StatuslineFileFormat() + endfunction + function! SFE() + return StatuslineFileEncoding() + endfunction function! SSG() return StatuslineSyntaxGroup() endfunction @@ -424,6 +447,12 @@ if has('statusline') set statusline+=%m " [+] if buffer was modified, " [-] if 'modifiable' is off set statusline+=%r " [RO] if buffer is read only + if v:version >= 700 " %#..# needs 7.0 + set statusline+=%#Error# " display warnings + set statusline+=%{SFF()} " - unexpected file format + set statusline+=%{SFE()} " - unexpected file encoding + set statusline+=%## " continue with normal colors + endif " on the right set statusline+=%= " right align @@ -584,7 +613,7 @@ nnoremap ; :call setline(line('.'), getline('.') . ';') " and all nerds involved (godlygeek, strull in #vim on Freenode). if has('eval') function! s:VSetSearch() - let l:temp = @@ + let l:temp = @@ " unnamed register normal! gvy " Added \C to force 'noignorecase' while searching the current visual " selection. I want to search for the exact string in this case.