X-Git-Url: http://git.iain.cx/?p=profile.git;a=blobdiff_plain;f=.vimrc;h=4474f89f689d48bc1c5a556e412ba5addfd11526;hp=4cc55d48e4642630d65a90773c511daf0c640602;hb=6820eb1c212480b684a7cc6144349721add08e7e;hpb=cc26e7919284779febb332c3f96b24575403e21d diff --git a/.vimrc b/.vimrc index 4cc55d4..4474f89 100755 --- a/.vimrc +++ b/.vimrc @@ -33,16 +33,17 @@ fun! Iain_Vars() endfun fun! Cycle_List() + let basic='tab:\\_,trail:_,extends:<,precedes:>' call Iain_Vars() let b:iainlist = b:iainlist + 1 if b:iainlist > 2 | let b:iainlist = 0 | endif if b:iainlist == 0 set nolist elseif b:iainlist == 1 - set lcs=tab:\\_,trail:_,extends:<,precedes:> + exec "set lcs=" . basic set list else - set lcs=tab:\\_,trail:_,extends:<,precedes:>,eol:$ + exec "set lcs=" . basic . ",eol:$" set list endif endfun @@ -65,11 +66,13 @@ endfun fun! Cycle_StatusLine() call Iain_Vars() let b:iainhex = ! b:iainhex + let sl1='%2n\:\ %<%f\ [%{Show_List()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%Y%M%R]\ %=' + let sl2='\ \|\ P:%4.6o\ L:%4.6l/%-4.6L\ C:%3.6c\ \|\ %P' + let hexformat='%b' if b:iainhex - set statusline=%2n\:\ %<%f\ [%{Show_List()}%{Show_Case()}%{Show_Tabstop()}%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()}%{Show_Tabstop()}%Y%M%R]\ %=%b\ (%3.6c,%-4.6l)\ %4.6o\ \|\ %4.6L\ %P + let hexformat='0\x%02B' endif + exec "set statusline=" . sl1 . hexformat . sl2 endfun " Save the current window width so if we change it we can restore it @@ -86,6 +89,10 @@ map = yyp:s/./=/g:let @/='': command! W :w se tags=~/.ctags +" Make * and # work the way you expect in visual mode. +vnoremap * y/\V=substitute(escape(@@,"/\\"),"\n","\\\\n","ge") +vnoremap # y?\V=substitute(escape(@@,"?\\"),"\n","\\\\n","ge") + fun! Invert_Case() let &ic = ! &ic endfun @@ -98,6 +105,10 @@ fun! Show_Tabstop() return &ts endfun +fun! Show_Paste() + if &paste | return "p" | else | return "" | endif +endfun + " Clear Q as we will use it for commands. map Q @@ -113,6 +124,13 @@ map Q2 :se ts=2: map Q4 :se ts=4: " Change to ts=8 with Q8. map Q8 :se ts=8: +" Change to ts=16 with Q6. +map Q6 :se ts=16: +" Change to ts=32 with Q3. +map Q3 :se ts=32: + +" Vim 7 has tabs. Default "next tab" mapping is gt. Add "previous tab" as gb. +map gb :tabPrev call Cycle_StatusLine() @@ -130,11 +148,6 @@ au BufLeave * if &ft == "c" || &ft == "cpp" | call CMode_unmap() | endif au BufEnter * if &ft == "perl" | call PerlMode_map() | endif au BufLeave * if &ft == "perl" | call PerlMode_unmap() | endif -" ... For PHP files: - -au BufEnter * if &ft == "php" | call PHPMode_map() | endif -au BufLeave * if &ft == "php" | call PHPMode_unmap() | endif - " ... For makefiles: au BufEnter * if &ft == "make" | call MakeMode_map() | endif @@ -163,16 +176,6 @@ fun! PerlMode_unmap() set foldmethod=manual endfun -fun! PHPMode_map() - set nocindent - set autoindent -endfun - -fun! PHPMode_unmap() - set noautoindent - set cindent -endfun - " ... For makefiles: fun! MakeMode_map()