diff options
Diffstat (limited to 'vim')
-rw-r--r-- | vim/after/ftplugin/c.vim | 9 | ||||
-rw-r--r-- | vim/after/ftplugin/cpp.vim | 9 | ||||
-rw-r--r-- | vim/after/indent/vim.vim | 5 | ||||
-rw-r--r-- | vim/after/syntax/gitcommit.vim | 6 | ||||
-rw-r--r-- | vim/after/syntax/messages.vim | 6 | ||||
-rw-r--r-- | vim/after/syntax/sh.vim | 14 | ||||
-rw-r--r-- | vim/ftdetect/perl.vim | 2 | ||||
-rw-r--r-- | vim/plugin/wildignore.vim | 15 | ||||
-rw-r--r-- | vim/system/centos.vim | 2 | ||||
-rw-r--r-- | vim/system/debian.vim | 4 | ||||
-rw-r--r-- | vim/vimrc | 21 |
11 files changed, 60 insertions, 33 deletions
diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim index e101b20c..fff9de04 100644 --- a/vim/after/ftplugin/c.vim +++ b/vim/after/ftplugin/c.vim @@ -5,5 +5,10 @@ endif " Set comment formats setlocal include=^\\s*#\\s*include -setlocal path+=/usr/include -let b:undo_ftplugin .= '|setlocal include< path<' +let b:undo_ftplugin .= '|setlocal include<' + +" Include headers on UNIX +if has('unix') + setlocal path+=/usr/include + let b:undo_ftplugin .= '|setlocal path<' +endif diff --git a/vim/after/ftplugin/cpp.vim b/vim/after/ftplugin/cpp.vim index a826bf43..38c94330 100644 --- a/vim/after/ftplugin/cpp.vim +++ b/vim/after/ftplugin/cpp.vim @@ -5,5 +5,10 @@ endif " Set comment formats setlocal include=^\\s*#\\s*include -setlocal path+=/usr/include -let b:undo_ftplugin .= '|setlocal include< path<' +let b:undo_ftplugin .= '|setlocal include<' + +" Include headers on UNIX +if has('unix') + setlocal path+=/usr/include + let b:undo_ftplugin .= '|setlocal path<' +endif diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index 73b4e430..ed1b8ebb 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -8,7 +8,6 @@ endif " Commands to undo the above if exists('b:undo_indent') - let b:undo_indent = b:undo_indent - \ . '|setlocal shiftwidth<' - \ . '|setlocal softtabstop<' + let b:undo_indent = b:undo_indent . '|setlocal shiftwidth<' + let b:undo_indent = b:undo_indent . '|setlocal softtabstop<' endif diff --git a/vim/after/syntax/gitcommit.vim b/vim/after/syntax/gitcommit.vim index e47091f9..2232e499 100644 --- a/vim/after/syntax/gitcommit.vim +++ b/vim/after/syntax/gitcommit.vim @@ -1,2 +1,8 @@ +" Don't try to make these corrections if running 'compatible' or if the +" runtime files are too old +if &compatible || v:version < 700 + finish +endif + " If my commit subject is too long, highlight it as an error. highlight link gitCommitOverflow Error diff --git a/vim/after/syntax/messages.vim b/vim/after/syntax/messages.vim index 04faa607..75fe89b9 100644 --- a/vim/after/syntax/messages.vim +++ b/vim/after/syntax/messages.vim @@ -1,3 +1,9 @@ +" Don't try to make these corrections if running 'compatible' or if the +" runtime files are too old +if &compatible || v:version < 700 + finish +endif + " The highlighting for errors in syslog/messages files is more often annoying " than useful, so just turn it off. syntax clear messagesError diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim index 026e4ebd..00f95fc0 100644 --- a/vim/after/syntax/sh.vim +++ b/vim/after/syntax/sh.vim @@ -1,7 +1,7 @@ -" Support line continuation for this file -if &compatible - let s:cpoptions_save = &cpoptions - set cpoptions-=C +" Don't try to make these corrections if running 'compatible' or if the +" runtime files are too old +if &compatible || v:version < 700 + finish endif " If we know we have another shell type, clear away the others completely, now @@ -216,9 +216,3 @@ if exists('b:is_bash') \ variables \ wait endif - -" Restore 'cpoptions' setting if we touched it -if exists('s:cpoptions_save') - let &cpoptions = s:cpoptions_save - unlet s:cpoptions_save -endif diff --git a/vim/ftdetect/perl.vim b/vim/ftdetect/perl.vim index 21a782c6..95830b0b 100644 --- a/vim/ftdetect/perl.vim +++ b/vim/ftdetect/perl.vim @@ -1,5 +1,5 @@ " If it's a new file in a bin, libexec, or scripts subdir that has a -" Makefile.PL, it's almost definitely Perl. +" Makefile.PL sibling, and I'm editing it, it's almost definitely Perl. autocmd filetypedetect BufNewFile \ */bin/* \,*/libexec/* diff --git a/vim/plugin/wildignore.vim b/vim/plugin/wildignore.vim index b87b62b1..b10eaa01 100644 --- a/vim/plugin/wildignore.vim +++ b/vim/plugin/wildignore.vim @@ -154,12 +154,15 @@ function! s:Wildignore() abort \,'*.swp' \ ] - " For any that had lowercase letters, add their uppercase analogues - for l:ignore in l:ignores - if l:ignore =~# '\l' - call add(l:ignores, toupper(l:ignore)) - endif - endfor + " If on a system where case matters for filenames, for any that had + " lowercase letters, add their uppercase analogues + if has('fname_case') + for l:ignore in l:ignores + if l:ignore =~# '\l' + call add(l:ignores, toupper(l:ignore)) + endif + endfor + endif " Return the completed setting return join(l:ignores, ',') diff --git a/vim/system/centos.vim b/vim/system/centos.vim index 0c5854d4..d5ea1036 100644 --- a/vim/system/centos.vim +++ b/vim/system/centos.vim @@ -13,7 +13,7 @@ if has('cscope') set cscopetag& set cscopetagorder& set cscopeverbose& - silent! cs kill + silent! cscope kill endif if has('gui') set guicursor& diff --git a/vim/system/debian.vim b/vim/system/debian.vim index 125a9240..1db56f74 100644 --- a/vim/system/debian.vim +++ b/vim/system/debian.vim @@ -17,5 +17,5 @@ endif set t_Co& t_Sf& t_Sb& " Remove addons directories from 'runtimepath' if present -silent! set runtimepath-=/var/lib/vim/addons -silent! set runtimepath-=/var/lib/vim/addons/after +set runtimepath-=/var/lib/vim/addons +set runtimepath-=/var/lib/vim/addons/after @@ -53,15 +53,18 @@ set backspace+=start " The start of current insertion " Do keep backups set backup -" Try to keep them all in one system-appropriate dir, with full path +" Try to keep backups in one system-appropriate dir if has('unix') - set backupdir^=~/.vim/cache/backup// + set backupdir^=~/.vim/cache/backup elseif has('win32') || has('win64') - set backupdir^=~/vimfiles/cache/backup// + set backupdir^=~/vimfiles/cache/backup endif " Don't back up stuff in /dev/shm or /var/tmp -set backupskip+=/dev/shm/*,/var/tmp/* +if has('unix') + set backupskip+=/dev/shm/* + set backupskip+=/var/tmp/* +endif " Try to keep swapfiles in one system-appropriate dir if has('unix') @@ -77,6 +80,11 @@ else set display=lastline " Just let it run off the screen if not endif +" If $LANG isn't set and 'encoding' is the default, use UTF-8 +if has('multi_byte') && !exists('$LANG') && &encoding ==# 'latin1' + set encoding=utf-8 +endif + " Don't wait for a key after Escape in insert mode if exists('+esckeys') " Not in Neovim set noesckeys @@ -137,9 +145,10 @@ if has('extra_search') set incsearch " Show matches as I type endif -" More sensible language-agnostic setting for gf/:find +" Options for file search with gf/:find if has('file_in_path') - set path=.,,** + set path-=/usr/include " Let the C/C++ filetypes set that + set path+=** " Search current directory's whole tree endif " Don't load GUI menus; set here before GUI starts |