X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=.vimrc;h=ab318daaa0cbf916fdebe37921c324156f16f629;hb=2a3015e18dd1c2057f61d58011badd4e5a6add62;hp=b6ba9a8dcef02553c03d18148d13437cde7f9f2c;hpb=832105f1cffb94d0193777f6c1d3ddc98be1e24d;p=profile.git diff --git a/.vimrc b/.vimrc index b6ba9a8..ab318da 100644 --- a/.vimrc +++ b/.vimrc @@ -348,6 +348,8 @@ endif if has("win32") se guifont=DejaVu_Sans_Mono:h10:cANSI endif +hi! link TabLineSel StatusLine +hi! link TabLine StatusLineNC " Ignore whitespace when diffing. se diffopt=filler,iwhite @@ -484,6 +486,77 @@ endif if version >= "700" version 7.0 +" Tab line. +fun! Show_TabLine() + let s = "%#TabLineFill#Tabs:" + + for i in range(tabpagenr("$")) + let n = i + 1 + " Get the label. + let buflist = tabpagebuflist(n) + let winnr = tabpagewinnr(n) + let label = bufname(buflist[winnr - 1]) + if label == "" + let label = "No Name" + else + let label = fnamemodify(label, ":t") + if strlen(label) >= 18 + let label = label[0:17] . ".." + endif + endif + + " Find out if any buffer was modified. + let modified = '' + for j in buflist + if getbufvar(j, "&modified") == 1 + let modified = '+' + break + endif + endfor + + " Choose highlighting. + if n == tabpagenr() + let s .= "%#TabLineSel#[" . n . modified . " " . label . "]" + else + let s .= "%#TabLine# " . n . modified . " " . label . " " + endif + endfor + + " Padding. + let s .= "%#TabLine#%T" + return s +endfun + +" Per tab label for the GUI. +fun! Show_GUITabLine() + let s = "" + let buflist = tabpagebuflist(v:lnum) + let winnr = tabpagewinnr(v:lnum) + + let label = bufname(buflist[winnr - 1]) + if label == "" + let label = "[No Name]" + else + let label = fnamemodify(label, ":t") + if strlen(label) >= 18 + let label = label[0:17] . ".." + endif + endif + + for j in buflist + if getbufvar(j, "&modified") == 1 + let s .= "+" + break + endif + endfor + + let s .= " " . label + return s +endfun + +set tabline=%!Show_TabLine() +set guitablabel=%!Show_GUITabLine() + au CursorHoldI * call Highlight_StatusLine("H") au CursorMovedI * call Highlight_StatusLine("h") au FocusGained * call Highlight_StatusLine("F") @@ -498,13 +571,16 @@ se diffopt+=vertical se numberwidth=5 " Add "previous tab" mapping as gb. -map gb :tabPrev +map gb :tabprevious: " Transparency. if has("gui_macvim") se transparency=15 endif +" Yet more GUI options. Add tabs. +se go+=e + " Perforce. let g:p4EnableMenu=1 let g:p4Presets='P4CONFIG'