" Update more quickly. For use with sign highlighting as polling for
" CursorMove makes redrawing slow.
-se updatetime=500
+if has("signs")
+ se updatetime=500
+endif
" Enable tab-completion prompting for commands.
se wildmenu
autocmd!
augroup Mode
autocmd!
-augroup Signs
-autocmd!
+if has("signs")
+ augroup Signs
+ autocmd!
+endif
augroup StatusLine
autocmd!
augroup END
if ! exists("g:iainextracolumns")
let g:iainextracolumns = 0
endif
- if ! exists("g:marksigns")
- let g:marksigns = 0
- endif
- if ! exists("g:firstsign")
- let g:firstsign = 100
+ if has("signs")
+ if ! exists("g:marksigns")
+ let g:marksigns = 0
+ endif
+ if ! exists("g:firstsign")
+ let g:firstsign = 100
+ endif
endif
endfun
endfun
" Toggle number display.
-fun! Number()
+fun! Number(resize)
call Iain_Vars()
let &number = ! &number
if l:num_numbers == 0
let g:iainextracolumns = 0
- call Resize_Columns("-")
+ if a:resize
+ call Resize_Columns("-")
+ endif
elseif g:iainextracolumns == 0
let g:iainextracolumns = 1
- call Resize_Columns("+")
+ if a:resize
+ call Resize_Columns("+")
+ endif
endif
endif
endfun
" Restore window size.
-au Display VimLeave * if exists("oldcols") | let &columns=oldcols | endif
+au Display VimLeave * if exists("oldcols") | call Resize_Columns("-", (&columns - oldcols)) | endif
" Map Makefile mode.
au Mode BufEnter * if &ft == "make" | call MakeMode_map() | endif
" Swap case-sensitivity with \c.
call Mapping("c", ":call Invert_Case()<CR>:<CR>")
" Change number mode with \n.
-call Mapping("n", ":call Number()<CR>:<CR>")
+call Mapping("n", ":call Number(1)<CR>:<CR>")
" Expand or shrink window size with \> and \<.
call Mapping(">", ":call Resize_Columns('+')<CR>:<CR>")
call Mapping("<", ":call Resize_Columns('-')<CR>:<CR>")
" Vim tip 99: What's the highlighting group under the cursor?
call Mapping("h", ":echo \"hi<\" . synIDattr(synID(line(\".\"),col(\".\"),1),\"name\") . '> trans<' . synIDattr(synID(line(\".\"),col(\".\"),0),\"name\") . \"> lo<\" . synIDattr(synIDtrans(synID(line(\".\"),col(\".\"),1)),\"name\") . \">\"<CR>")
+fun! <SID>Startup_Resize()
+ " Resize for numbers.
+ if version >= "700"
+ let l:columns = &numberwidth
+ else
+ let l:columns = 8
+ endif
+
+ " Resize for signs.
+ if has("signs")
+ if version >= "600"
+ let l:columns += 2
+ endif
+ endif
+
+ call Resize_Columns("+", l:columns)
+endfun
+
" Show numbers by default.
-au Display VimEnter * call Number()
+au Display VimEnter * call Number(0)
+
+" Resize after startup.
+au Display VimEnter * call <SID>Startup_Resize()
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
vnoremap # y?\V<C-R>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR>
" Set mark and update highlighting.
-au Signs BufEnter * call <SID>Highlight_Signs()
-au Signs CursorHold * call <SID>Highlight_Signs()
+if has("signs")
+ au Signs BufEnter * call <SID>Highlight_Signs()
+ au Signs CursorHold * call <SID>Highlight_Signs()
+endif
fun! <SID>Prep_Signs()
if ! exists("b:signdot") || ! g:marksigns
endfun
fun! <SID>Highlight_Signs(...)
- if ! g:marksigns
+ if ! has("signs") || ! g:marksigns
return
endif
endfun
" Toggle signs.
-fun! <SID>Cycle_Signs()
+fun! <SID>Cycle_Signs(resize)
+ if ! has("signs")
+ return
+ endif
call Iain_Vars()
let g:marksigns = ! g:marksigns
sign define MarkE text=E texthl=MarkSign linehl=MarkLine
sign define MarkF text=F texthl=MarkSign linehl=MarkLine
- call Resize_Columns("+", 2)
+ if a:resize
+ call Resize_Columns("+", 2)
+ endif
call <SID>Highlight_Signs()
else
exe "sign unplace " . (g:firstsign + 0)
sign undefine MarkF
call <SID>Prep_Signs()
- call Resize_Columns("-", 2)
+ if a:resize
+ call Resize_Columns("-", 2)
+ endif
endif
endfun
" updated as a side-effect.
call Mapping("s", ":filetype detect<CR>:<CR>")
" Toggle marks with \m.
-call Mapping("m", ":call <SID>Cycle_Signs()<CR>:<CR>")
+call Mapping("m", ":call <SID>Cycle_Signs(1)<CR>:<CR>")
fun! <SID>Iain_Colour(colour)
if &t_Co == 88
let l:termcolour = <SID>Iain_Colour(l:colour)
- exec "highlight StatusLine guifg=white guibg=" . l:colour . " ctermfg=white ctermbg=" . l:termcolour
+ exec "highlight StatusLine gui=bold term=bold cterm=bold guifg=white guibg=" . l:colour . " ctermfg=white ctermbg=" . l:termcolour
endfun
au Display VimEnter * call Highlight_StatusLine("")
" Show signs by default.
-au Display VimEnter * call <SID>Cycle_Signs()
+au Display VimEnter * call <SID>Cycle_Signs(0)
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
au StatusLine InsertEnter * call Highlight_StatusLine("I")
au StatusLine InsertLeave * call Highlight_StatusLine("i")
-au Signs InsertEnter * call <SID>Highlight_Signs()
-au Signs InsertLeave * call <SID>Highlight_Signs()
+if has("signs")
+ au Signs InsertEnter * call <SID>Highlight_Signs()
+ au Signs InsertLeave * call <SID>Highlight_Signs()
+endif
" Limit the size of the popup menu when completing.
se pumheight=20