se bg=dark
endif
-" Allow mouse use in a terminal.
-se mouse=nvir
+" Allow mouse use in a terminal but only if it can work.
+if has("xterm_clipboard")
+ se mouse=nvir
+endif
" Update more quickly. For use with sign highlighting as polling for
" CursorMove makes redrawing slow.
augroup END
" Save the current window width so we can restore it when we quit.
-if ! exists("oldcols")
- let oldcols=&columns
+if ! exists("g:oldcols")
+ let g:oldcols=&columns
endif
-" More GUI options. Add icon, tearoffs and toolbar.
-se go+=itT
+" More GUI options. Add icon and tearoffs.
+se go+=i
+se go+=t
" Allow dynamic window resize even if we aren't in an xterm.
se t_WS=\e[8;%p1%d;%p2%dt
syn on
endif
-" Use a discernably different colour to highlight the cursor which shows
-" matching brackets. Our regular cursor is green so use blue instead of cyan.
-hi MatchParen ctermbg=blue
-
" Catch typos.
command! W :w
command! Wq :wq
let l:columns = a:1
endif
- let l:resize = "se columns" . a:op . "=" . l:columns
+ exe "let l:resize=" . &columns . a:op . l:columns
+ let l:resize = "se columns=" . l:resize
" HACK: Inside screen there is an extra line for the status bar. Vim
" manages the resize by sending an escape sequence to set the number of
" the real terminal being shrunk by a line. We ask for the terminal to grow
" by a line so it ends up actually being the same.
if &term =~ '^screen'
- let l:resize .= " lines+=1"
+ let l:resize = l:resize . " lines=" . (&lines + 1)
endif
- exec l:resize
+ exe l:resize
endfun
" Toggle number display.
endfun
" Restore window size.
-au Display VimLeave * if exists("oldcols") | call Resize_Columns("-", (&columns - oldcols)) | endif
+au Display VimLeave * if exists("g:oldcols") | call Resize_Columns("-", (&columns - g:oldcols)) | endif
" Map Makefile mode.
au Mode BufEnter * if &ft == "make" | call MakeMode_map() | endif
" 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()
+fun! Uncluttered_Buffer()
+ if exists("uncluttered_buffer")
+ if uncluttered_buffer == 1
+ return 1
+ endif
+ endif
+
+ if version >= "600"
+ if &buftype != ''
+ return 1
+ endif
+ endif
+
+ if &ft == 'perforce'
+ return 1
+ endif
+
+ if &ft == 'svn'
+ return 1
+ endif
+
+ if &ft == 'gitcommit'
+ return 1
+ endif
+
+ return 0
+endfun
+
+fun! Startup_Resize()
+ let l:columns = 0
+
" Resize for numbers.
- if version >= "700"
- let l:columns = &numberwidth
- else
- let l:columns = 8
+ if &number
+ if version >= "700"
+ let l:columns = &numberwidth
+ else
+ let l:columns = 8
+ endif
endif
" Resize for signs.
if has("signs")
- if version >= "600"
- let l:columns += 2
+ if g:marksigns
+ if version >= "600"
+ let l:columns = l:columns + 2
+ endif
endif
endif
- call Resize_Columns("+", l:columns)
+ if g:oldcols < (80 + l:columns)
+ call Resize_Columns("+", l:columns)
+ endif
endfun
" Show numbers by default.
-au Display VimEnter * call Number(0)
-
-" Resize after startup.
-au Display VimEnter * call <SID>Startup_Resize()
+au Display VimEnter * if ! Uncluttered_Buffer() | call Number(0) | endif
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
endfun
fun! <SID>Highlight_Signs(...)
- if ! has("signs") || ! g:marksigns
+ if ! has("signs") || ! g:marksigns || Uncluttered_Buffer()
return
endif
" Find out if any buffer was modified.
fun! <SID>TabModified(buflist)
let l:i = 0
- while i < len(a:buflist)
+ while l:i < len(a:buflist)
if getbufvar(a:buflist[l:i], "&modified") == 1
return "+"
endif
let g:p4EnableMenu=1
let g:p4Presets='P4CONFIG'
endif
+
+if version >= "500"
+" Resize after startup.
+au Display VimEnter * call Startup_Resize()
+endif