From: Iain Patterson Date: Fri, 7 Aug 2009 18:08:21 +0000 (+0100) Subject: Unicode stuff. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=a01cb8586b48059b306ca90b212fee5f5c3b9d13;p=profile.git Unicode stuff. Force UTF-8 on Windows. Move Unicode availability test to Has_Unicode() function. Show Unicode signs where possible. --- diff --git a/.vimrc b/.vimrc index 500794f..f163e3d 100644 --- a/.vimrc +++ b/.vimrc @@ -456,6 +456,10 @@ endif if version >= "600" version 6.0 +if has("win32") + se encoding=utf-8 +endif + " Remember quickfix state. let g:quickfixing=0 @@ -641,9 +645,15 @@ fun! Cycle_Signs(resize) if g:marksigns " Signs to highlight marks. " Syntax won't work properly in Vim 6. - sign define MarkDash text=' texthl=MarkSign - sign define MarkDot text=* texthl=MarkDot - sign define MarkQuote text=" texthl=MarkSign + if Has_Unicode() + sign define MarkDash text=’ texthl=MarkSign + sign define MarkDot text=• texthl=MarkDot + sign define MarkQuote text=” texthl=MarkSign + else + sign define MarkDash text=' texthl=MarkSign + sign define MarkDot text=* texthl=MarkDot + sign define MarkQuote text=" texthl=MarkSign + endif sign define MarkCaret text=^ texthl=MarkDot sign define MarkLess text=< texthl=MarkSign sign define MarkGreater text=> texthl=MarkSign @@ -729,10 +739,30 @@ fun! Cycle_Signs(resize) endif endfun +fun! Has_Unicode() + if ! has('multi_byte') + return 0 + endif + + if version < "602" + return 0 + endif + + if &tenc =~? '^u\(tf\|cs\)' + return 1 + endif + + if ! strlen(&tenc) && &enc =~? '^u\(tf\|cs\)' + return 1 + endif + + return 0 +endfun + " Change list mode. fun! Cycle_List() " Pretty UTF-8 listchars. - if has('multi_byte') && (&tenc =~? '^u\(tf\|cs\)' || (! strlen(&tenc) && &enc =~? '^u\(tf\|cs\)')) && v:version >= "602" + if Has_Unicode() let basic='tab:»·,trail:…,extends:«,precedes:»' let eol='eol:¶' if version >= "700"