From: Iain Patterson Date: Wed, 5 Feb 2014 09:45:36 +0000 (+0000) Subject: Tidy up Show_Encoding(). X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=56d7364df9209bffe2ca58df0474e2555b75cb45;p=profile.git Tidy up Show_Encoding(). Show the BOM indicator before the encoding name. It was hard to make out after, eg utf-16le. Show a dot indicator before the encoding when no file is loaded, rather than the encoding in brackets. --- diff --git a/.vimrc b/.vimrc index 302efbb..4607a5e 100644 --- a/.vimrc +++ b/.vimrc @@ -669,27 +669,45 @@ endfun "}}}2 " Helper for status line. " Show file encoding -func! Show_Encoding() "{{{2 +fun! Show_Encoding() "{{{2 + if version < "600" + return "" + endif + let l:enc = &fenc + let l:symbol = "" if l:enc == "" let l:enc = &enc if l:enc == "" return "" endif - let l:enc = '(' . l:enc . ')' + if bufname("%") == "" + if Has_Unicode() + let l:symbol = '•' + else + let l:symbol = '*' + endif + endif endif if has("multi_byte") if &bomb if Has_Unicode() - let l:enc = l:enc . "☻" + let l:symbol = "☻" else - let l:enc = l:enc . "@" + let l:symbol = "@" endif endif endif - return l:enc . "," + " Don't return anything if the encoding is utf-8. + if l:enc == "utf-8" + if l:symbol == "" + return "" + endif + endif + + return l:symbol . l:enc . "," endfun "}}}2 " Helper for status line.