endif
+" TERMINAL SETTINGS
+
+" Also enable fast terminal mode in GNU screen and tmux, but not for SSH
+" connections.
+if &term =~# '^screen' && !exists('$SSH_CONNECTION')
+ set ttyfast
+endif
+
+
" EDIT SETTINGS
" Enable automatic file detection, plugin and indention support.
" (add ! to override)" warning when switching buffers.
set hidden
+" When splitting vertically put the new window right of the current one.
+if has('vertsplit')
+ set splitright
+endif
+
" DISPLAY SETTINGS
" If there's more than one buffer return "/<nr>" (e.g. "/05") where <nr>
" is the highest buffer number, otherwise return nothing. Used in
" 'statusline' to get an overview of available buffer numbers.
- function! StatuslineBufferCount()
+ function! s:StatuslineBufferCount()
let l:bufnr = bufnr('$')
if l:bufnr > 1
let l:result = '/'
" Like %f but use relative filename if it's shorter than the absolute path
" (e.g. '../../file' vs. '~/long/path/to/file'). fnamemodify()'s ':.' is
" not enough because it doesn't create '../'s.
- function! StatuslineRelativeFilename()
+ function! s:StatuslineRelativeFilename()
" Display only filename for help files.
if &buftype == 'help'
return expand('%:t')
endfunction
" Return current syntax group in brackets or nothing if there's none.
- function! StatuslineSyntaxGroup()
+ function! s:StatuslineSyntaxGroup()
let l:group = synIDattr(synID(line('.'), col('.'), 1), 'name')
if l:group != ''
return '[' . l:group . '] '
endif
endfunction
+ " Short function names to make 'statusline' more readable.
+ function! SBC()
+ return <SID>StatuslineBufferCount()
+ endfunction
+ function! SRF()
+ return <SID>StatuslineRelativeFilename()
+ endfunction
+ function! SSG()
+ return <SID>StatuslineSyntaxGroup()
+ endfunction
+
set statusline=
" on the left
- set statusline+=%02n " buffer number
- set statusline+=%{StatuslineBufferCount()} " highest buffer number
+ set statusline+=%02n " buffer number
+ set statusline+=%{SBC()} " highest buffer number
set statusline+=:
if has('modify_fname') && v:version >= 700 " some functions need 7.0
- set statusline+=%{StatuslineRelativeFilename()} " path to current file
- set statusline+=\ " space after path
+ set statusline+=%{SRF()} " path to current file
+ set statusline+=\ " space after path
else
- set statusline+=%f\ " path to current file in buffer
+ set statusline+=%f\ " path to current file in buffer
endif
- set statusline+=%h " [help] if buffer is help file
- set statusline+=%w " [Preview] if buffer is preview buffer
- set statusline+=%m " [+] if buffer was modified,
- " [-] if 'modifiable' is off
- set statusline+=%r " [RO] if buffer is read only
+ set statusline+=%h " [help] if buffer is help file
+ set statusline+=%w " [Preview] if buffer is preview buffer
+ set statusline+=%m " [+] if buffer was modified,
+ " [-] if 'modifiable' is off
+ set statusline+=%r " [RO] if buffer is read only
" on the right
set statusline+=%= " right align
" and all nerds involved (godlygeek, strull in #vim on Freenode).
if has('eval')
function! s:VSetSearch()
- let l:temp = @@
+ let l:temp = @@ " unnamed register
normal! gvy
" Added \C to force 'noignorecase' while searching the current visual
" selection. I want to search for the exact string in this case.
let g:perl_fold_blocks = 1
let g:perl_nofold_packages = 1
let g:perl_include_pod = 1 " syntax coloring for PODs
+ " PHP.
+ let g:php_folding = 3 " fold functions
+ let g:php_short_tags = 0 " no short tags (<? .. ?>), not always usable
+ let g:php_sql_query = 1 " highlight SQL queries in strings
" Python.
let g:python_highlight_all = 1
" Shell.
autocmd InsertLeave * set nopaste
endif
-" Write file when running :mak[e] before 'makeprg' is called. QuickFixCmdPre
-" doesn't exist in older Vims.
+" Write all files when running :mak[e] before 'makeprg' is called.
+" QuickFixCmdPre doesn't exist in older Vims.
if exists('##QuickFixCmdPre')
- autocmd QuickFixCmdPre * write
+ autocmd QuickFixCmdPre * wall
endif
" Don't ignore case while in insert mode, but ignore case in all other modes.
return
endif
- echohl WarningMsg
- echo 'Do not edit this file! (Maybe a template file.)'
- echohl None
+ echoerr 'Do not edit this file! (Maybe a template file.)'
endfunction
autocmd BufRead * call <SID>SearchForDoNotEditHeader()