Don't toggle hexmode when opening a new buffer.
authorIain Patterson <me@iain.cx>
Mon, 27 Nov 2006 13:17:25 +0000 (13:17 +0000)
committerIain Patterson <me@iain.cx>
Mon, 27 Nov 2006 13:17:25 +0000 (13:17 +0000)
Added Qf to toggle opening and closing all folds.
Added Qn to toggle line numbers.

git-svn-id: https://svn.cambridge.iain.cx/profile/trunk@36 6be0d1a5-5cfe-0310-89b6-964be062b18b

.vimrc

diff --git a/.vimrc b/.vimrc
index 4474f89..7abde90 100755 (executable)
--- a/.vimrc
+++ b/.vimrc
@@ -29,9 +29,11 @@ endif
 " Set up our variables.
 fun! Iain_Vars()
   if ! exists("b:iainlist") | let b:iainlist = 0 | endif
 " 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
+  if ! exists("b:iainhex") | let b:iainhex = 0 | endif
+  if ! exists("b:iainfold") | let b:iainfold = 0 | endif
 endfun
 
 endfun
 
+" Change list mode.
 fun! Cycle_List()
   let basic='tab:\\_,trail:_,extends:<,precedes:>'
   call Iain_Vars()
 fun! Cycle_List()
   let basic='tab:\\_,trail:_,extends:<,precedes:>'
   call Iain_Vars()
@@ -48,6 +50,13 @@ fun! Cycle_List()
   endif
 endfun
 
   endif
 endfun
 
+" Toggle folds.
+fun! Cycle_Fold()
+  call Iain_Vars()
+  let b:iainfold = ! b:iainfold
+  if b:iainfold | foldclose | else | foldopen | endif
+endfun
+
 fun! Show_List()
   call Iain_Vars()
   if b:iainlist == 0
 fun! Show_List()
   call Iain_Vars()
   if b:iainlist == 0
@@ -63,9 +72,14 @@ fun! Show_List()
 endfun
 
 " Cycle between hex and decimal display of toolbar stuff.
 endfun
 
 " Cycle between hex and decimal display of toolbar stuff.
-fun! Cycle_StatusLine()
+fun! Cycle_HexStatusLine()
   call Iain_Vars()
   let b:iainhex = ! b:iainhex
   call Iain_Vars()
   let b:iainhex = ! b:iainhex
+  call Show_StatusLine()
+endfun
+
+fun! Show_StatusLine()
+  call Iain_Vars()
   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'
   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'
@@ -113,7 +127,7 @@ endfun
 map Q <Nop>
 
 " Swap hex/decimal statusline with Qx
 map Q <Nop>
 
 " Swap hex/decimal statusline with Qx
-map Qx :call Cycle_StatusLine()<CR>:<CR>
+map Qx :call Cycle_HexStatusLine()<CR>:<CR>
 " Swap case-sensitivity with Qc.
 map Qc :call Invert_Case()<CR>:<CR>
 " Cycle list styles with Ql.
 " Swap case-sensitivity with Qc.
 map Qc :call Invert_Case()<CR>:<CR>
 " Cycle list styles with Ql.
@@ -128,11 +142,15 @@ map Q8 :se ts=8<CR>:<CR>
 map Q6 :se ts=16<CR>:<CR>
 " Change to ts=32 with Q3.
 map Q3 :se ts=32<CR>:<CR>
 map Q6 :se ts=16<CR>:<CR>
 " Change to ts=32 with Q3.
 map Q3 :se ts=32<CR>:<CR>
+" Change foldmethod with Qf.
+map Qf :call Cycle_Fold()<CR>:<CR>
+" Change number mode with Qn.
+map Qn :se number!<CR>:<CR>
 
 " Vim 7 has tabs.  Default "next tab" mapping is gt.  Add "previous tab" as gb.
 map gb :tabPrev<CR>
 
 
 " Vim 7 has tabs.  Default "next tab" mapping is gt.  Add "previous tab" as gb.
 map gb :tabPrev<CR>
 
-call Cycle_StatusLine()
+call Show_StatusLine()
 
 au VimLeave * if exists("andyoldcols") | let &columns=andyoldcols | endif
 
 
 au VimLeave * if exists("andyoldcols") | let &columns=andyoldcols | endif