X-Git-Url: http://git.iain.cx/?p=profile.git;a=blobdiff_plain;f=.vimrc;h=d4376a0665f5abe31140e285ef5f10dd7e918a65;hp=5a3622a21c39d62d247233a31e9532bc57dca113;hb=6c82a1ef785f1d3ad8b31f20eb33d11ecccf4e8e;hpb=ffda7fdecab70b22554d7c9df55fb1a8cded5b1d diff --git a/.vimrc b/.vimrc index 5a3622a..d4376a0 100755 --- a/.vimrc +++ b/.vimrc @@ -1,4 +1,5 @@ " $Id$ +se nocp se ts=2 se bs=2 se sw=2 @@ -24,10 +25,14 @@ if has("win32") endif :autocmd! -" Initialise list format per buffer. -au BufEnter * let b:iainlist = 0 +" 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 @@ -42,6 +47,7 @@ fun Cycle_List() endfun fun Show_List() + call Iain_Vars() if b:iainlist == 0 " No list. return " " @@ -54,6 +60,17 @@ fun Show_List() endif 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 + else + set statusline=%2n\:\ %<%f\ [%{Show_List()}][%{Show_Case()}]%y%m%r%\ =%b\ (%3.6c,%-4.6l)\ %4.6o\ \|\ %4.6L\ %P + endif +endfun + " Save the current window width so if we change it we can restore it " when we quit. let andyoldcols=&columns @@ -76,12 +93,15 @@ fun Show_Case() if &ic | return "ca" | else | return "Ca" | endif endfun -set statusline=%2n\:\ %<%t\ [%{Show_List()}][%{Show_Case()}]%y%m%r%=%b\ 0\x%02B\ (%3.6c,%-4.6l)\ %4.6L\ %P +" Swap hex/decimal statusline with ,x +map ,x :call Cycle_StatusLine(): " Swap case-sensitivity with ,c. 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... @@ -123,7 +143,6 @@ endfun fun PerlMode_map() set cinkeys=0{,0},:,!^F,o,O,e set cinwords=if,else,while,do,for,eval - set foldmethod=indent endfun fun PerlMode_unmap() @@ -133,13 +152,11 @@ endfun fun PHPMode_map() set nocindent set autoindent - set foldmethod=indent endfun fun PHPMode_unmap() set noautoindent set cindent - set foldmethod=manual endfun " ... For makefiles: