""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" $Id$
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Multi-version vimrc compatible with version 4 and above.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Note that "if <condition> | call Something() | endif" syntax is unsupported
" in Vim 4 so we write all our functions out the long way. It does work in
if version >= "600"
version 6.0
+" Allow room for numbers.
+se numberwidth=5
+
+" Track changing number mode.
+let g:numbercols=&columns
+let g:numberchanges=0
+
" Less intrusive syntax highlighting.
syn enable
" Status bar matches the colour.
highlight StatusLine guifg=white guibg=blue ctermbg=white ctermfg=blue
+" Numbers in blue.
+highlight LineNr term=underline cterm=bold guifg=blue ctermfg=blue
+
" Make * and # work the way you expect in visual mode.
vnoremap * y/\V<C-R>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR>
vnoremap # y?\V<C-R>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR>
call Show_StatusLine()
endfun
+" Cycle between number mode.
+" FIXME: Toggling in a split window doesn't work properly. We need to track
+" the number of windows and number modes. Something for later...
fun! Cycle_Number()
if &number
" Restore width.
if &t_WS =~ '^\e.'
- let &columns=g:numbercols
+ " Track changes.
+ let g:numberchanges=g:numberchanges-1
+ if g:numberchanges<0
+ g:numberchanges=0
+ endif
+
+ " Change size back if this was the last window.
+ if g:numberchanges == 0
+ let &columns=g:numbercols
+ endif
endif
set nonumber
else
" Save width between number toggling.
if &t_WS =~ '^\e'
- let g:numbercols=&columns
- let &columns=&columns+5
+ " Expand if this was the first change.
+ if g:numberchanges == 0
+ let g:numbercols=&columns
+ let &columns=&columns+&numberwidth
+ endif
+
+ " Track changes.
+ let g:numberchanges=g:numberchanges+1
endif
set number
endif
endfun
+" Toggle case-sensitivity.
fun! Invert_Case()
let &ic = ! &ic
endfun
+
" We'll use Q for various commands. Unmap it.
map Q <Nop>