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.
" 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.