X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=vimrc;h=5bc0894bb96d27f5a174276aa8c84b13c7b57ec1;hb=35f1d8f86e839023a837fe978cd219fba168ff95;hp=3f94aefb7f20fe2677880a59f7b2eeb17540567b;hpb=cbf6334225a37daa7e89cdd9797358acef12e68d;p=config%2Fdotfiles.git diff --git a/vimrc b/vimrc index 3f94aef..5bc0894 100644 --- a/vimrc +++ b/vimrc @@ -105,6 +105,9 @@ if exists('+cryptmethod') set cryptmethod=blowfish endif +" Create new split windows on the right (and not left). +set splitright + " Clear all vimrc-related autocmds. Has to be done here as the vimrc augroup " is used multiple times. Necessary to support reloading the vimrc. if has('autocmd') @@ -137,6 +140,15 @@ if has('eval') 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. @@ -291,7 +303,7 @@ if has('statusline') " If there's more than one buffer return "/" (e.g. "/05") where " 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 = '/' @@ -314,7 +326,7 @@ if has('statusline') " 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') @@ -374,7 +386,7 @@ if has('statusline') 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 . '] ' @@ -383,22 +395,33 @@ if has('statusline') endif endfunction + " Short function names to make 'statusline' more readable. + function! SBC() + return StatuslineBufferCount() + endfunction + function! SRF() + return StatuslineRelativeFilename() + endfunction + function! SSG() + return 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 @@ -542,6 +565,11 @@ if exists('+spell') nnoremap sn :set nospell nnoremap se :set spell spelllang=en_us nnoremap sd :set spell spelllang=de_de +" If no spell support is available, these mappings do nothing. +else + nmap sn + nmap se + nmap sd endif " Add semicolon to the end of the line. Thanks to @@ -757,11 +785,17 @@ if has('syntax') let g:hs_highlight_boolean = 1 let g:hs_highlight_types = 1 let g:hs_highlight_more_types = 1 + " Java. + let g:java_highlight_java_lang_ids = 1 " color java.lang.* identifiers " Perl. let g:perl_fold = 1 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. @@ -867,10 +901,10 @@ if has('autocmd') 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. @@ -893,9 +927,7 @@ if has('autocmd') 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 SearchForDoNotEditHeader()