X-Git-Url: http://git.iain.cx/?p=profile.git;a=blobdiff_plain;f=.vimrc;h=03862f6ded795d4a96bb0492e6ace19ef5b6a2d1;hp=06f749b23b715c47cd6346432a3f8611d9cefe28;hb=4fcf9cd7282d42387e839ccc329edce4dc32e78b;hpb=d643f35d55b8c3ddf1ba3ebf5206267a74cd7652 diff --git a/.vimrc b/.vimrc index 06f749b..03862f6 100644 --- a/.vimrc +++ b/.vimrc @@ -614,6 +614,27 @@ endif "}}}1 if version >= "504" "{{{1 version 5.4 +" Do we have Unicode? +fun! Has_Unicode() "{{{2 + 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 "}}}2 + " Helper for status line. " Show space, underscore or dollar sign depending on list mode. fun! Show_List() "{{{2 @@ -621,7 +642,7 @@ fun! Show_List() "{{{2 if w:iainlist == 0 " No list. return " " - elseif Has_Unicode() + elseif Has_Unicode() if w:iainlist == 1 " Just tabs. return "»" @@ -665,6 +686,23 @@ fun! Show_Paste() "{{{2 endfun "}}}2 " Helper for status line. +" Show v when virtualedit mode is block, insert or onemore. +" Show V when virtualedit mode is all. +fun! Show_VirtualEdit() "{{{2 + if ! has("virtualedit") + return "" + endif + + if &ve == "all" + return "V" + elseif &ve + return "v" + else + return "" + endif +endfun "}}}2 + +" Helper for status line. " Show U when persistent undo is on. " Show u when persistent undo is off but an undofile exists. fun! Show_Undo() "{{{2 @@ -692,13 +730,34 @@ fun! Show_Alt() "{{{2 return " " . l:alt . ": " . expand("#:t") endfun "}}}2 +" Helper for status line. +" Show scrollbind or cursorbind. +fun! Show_Bind() "{{{2 + if has("cursorbind") + if &cursorbind + if Has_Unicode() + return "⇄" + else + return ">" + endif + elseif &scrollbind + if Has_Unicode() + return "⇅" + else + return "^" + endif + endif + endif + return "" +endfun "}}}2 + " Show the status line. fun! Show_StatusLine() "{{{2 if ! has("statusline") return endif call Iain_Vars() - let l:sl1='%2n\:\ %<%1*%f%0*\ [%{Show_List()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%{Show_Undo()}%Y%M%R]%{Show_Alt()}\ ' + let l:sl1='%2n\:\ %<%1*%f%0*\ [%{Show_List()}%{Show_Bind()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%{Show_VirtualEdit()}%{Show_Undo()}%Y%M%R]%{Show_Alt()}\ ' let l:sl3='L:%1*%4.6l%0*/%-4.6L\ C:%1*%3.6c%0*\ \|\ %P' let l:hexformat='%b' if b:iainhex @@ -847,7 +906,7 @@ fun! Cycle_Signs(resize) "{{{2 " Signs with Type '-' will be highlighted with the MarkLine group. " Signs with Type '.' will be highlighted with the MarkDot group. " Define the Mark where Symbol is not also the mark name, eg "']". - if Has_Unicode() + if Has_Unicode() let g:iainsigns = "Dash:'=’ Dot:..• Quote:\"=” Caret:^.ʌ" else let g:iainsigns = "Dash=' Dot:..* Quote=\" Caret.^" @@ -900,31 +959,10 @@ fun! Cycle_Signs(resize) "{{{2 endif endfun "}}}2 -" Do we have Unicode? -fun! Has_Unicode() "{{{2 - 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 "}}}2 - " Change list mode. fun! Cycle_List() "{{{2 " Pretty UTF-8 listchars. - if Has_Unicode() + if Has_Unicode() let basic='tab:»·,trail:…,extends:«,precedes:»' let eol='eol:¶' if version >= "700" @@ -1198,6 +1236,9 @@ let g:p4Presets='P4CONFIG' " BufExplorer. let g:bufExplorerShowRelativePath=1 let g:bufExplorerSplitOutPathName=0 + +" NERDcommenter. +let g:NERDSpaceDelims=1 endif "}}}1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -1281,6 +1322,10 @@ if has("autocmd") if has("persistent_undo") au File BufReadPost * call Check_Undo() endif + + if has("cursorbind") + au Display WinEnter * if &diff | se cursorbind | endif + endif endif endif "}}}1