X-Git-Url: http://git.iain.cx/?p=profile.git;a=blobdiff_plain;f=.vimrc;h=d4376a0665f5abe31140e285ef5f10dd7e918a65;hp=4ced5ef59f4a85beaa66de7efab0b2844aea7c89;hb=6c82a1ef785f1d3ad8b31f20eb33d11ecccf4e8e;hpb=ed46803e221991bc147b361ee0227d4fcf10dfab diff --git a/.vimrc b/.vimrc index 4ced5ef..d4376a0 100755 --- a/.vimrc +++ b/.vimrc @@ -25,10 +25,14 @@ if has("win32") endif :autocmd! -" Initialise list format per buffer. -au BufEnter * let b:iainlist = 0 | let b:iainhex = 1 | call Cycle_StatusLine() +" Set up our variables. +fun Iain_Vars() + if ! exists("b:iainlist") | let b:iainlist = 0 | endif + if ! exists("b:iainhex") | let b:iainhex = 1 | endif +endfun fun Cycle_List() + call Iain_Vars() let b:iainlist += 1 if b:iainlist > 2 | let b:iainlist = 0 | endif if b:iainlist == 0 @@ -43,6 +47,7 @@ fun Cycle_List() endfun fun Show_List() + call Iain_Vars() if b:iainlist == 0 " No list. return " " @@ -57,11 +62,12 @@ endfun " Cycle between hex and decimal display of toolbar stuff fun Cycle_StatusLine() + call Iain_Vars() let b:iainhex = ! b:iainhex if b:iainhex - set statusline=%2n\:\ %<%f\ [%{Show_List()}][%{Show_Case()}]%y%m%r%=0\x%02B\ (%3.6c,%-4.6l)\ 0\x%04.6O\ \|\ %4.6L\ %P + set statusline=%2n\:\ %<%f\ [%{Show_List()}][%{Show_Case()}]%y%m%r%\ =0\x%02B\ (%3.6c,%-4.6l)\ 0\x%04.6O\ \|\ %4.6L\ %P else - set statusline=%2n\:\ %<%f\ [%{Show_List()}][%{Show_Case()}]%y%m%r%=%b\ (%3.6c,%-4.6l)\ %4.6o\ \|\ %4.6L\ %P + set statusline=%2n\:\ %<%f\ [%{Show_List()}][%{Show_Case()}]%y%m%r%\ =%b\ (%3.6c,%-4.6l)\ %4.6o\ \|\ %4.6L\ %P endif endfun @@ -94,6 +100,8 @@ map ,c :call Invert_Case(): " Cycle list styles with ,l. map ,l :call Cycle_List(): +call Cycle_StatusLine() + au VimLeave * if exists("andyoldcols") | let &columns=andyoldcols | endif " Autocommands to setup features we only want in certain modes...