From 6ac60903d3dd364c578662b10654feb86b36b99c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 22 Jul 2018 19:54:49 +1200 Subject: More tweaking for Vim tiny compatibility --- vim/vimrc | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 2b2726bb..cbff6128 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -46,12 +46,9 @@ set backspace+=start " The start of current insertion " Try to keep backups in one system-appropriate dir set backup -set backupdir^=~/.vim/cache/backup -if has('win32') || has('win64') - set backupdir^=~/vimfiles/cache/backup -endif +set backupdir^=~/.vim/cache/backup,~/vimfiles/cache/backup -" Don't back up stuff in /dev/shm or /var/tmp +" Add some paths not to back up set backupskip+=/dev/shm/* set backupskip+=/var/tmp/* @@ -62,10 +59,7 @@ silent! set breakindent set comments= " Try to keep swapfiles in one system-appropriate dir -set directory^=~/.vim/cache/swap// -if has('win32') || has('win64') - set directory^=~/vimfiles/cache/swap// -endif +set directory^=~/.vim/cache/swap//,~/vimfiles/cache/swap// " Use UTF-8 if we can and env LANG didn't tell us not to if has('multi_byte') && !exists('$LANG') && &encoding ==# 'latin1' @@ -88,7 +82,9 @@ set history=500 " Highlight completed searches; clear on reload set hlsearch -silent! nohlsearch +if 1 + nohlsearch +endif " Don't assume I'm editing C; let the filetype set this set include= @@ -148,12 +144,6 @@ if has('gui_running') set guioptions+=M endif -" Don't store any options or mappings in sessions -if has('mksession') - set sessionoptions-=localoptions - set sessionoptions-=options -endif - " Keep undo files, hopefully in a dedicated directory if has('persistent_undo') set undofile @@ -163,8 +153,14 @@ if has('persistent_undo') endif endif +" Don't store any options or mappings in sessions +if exists('+sessionoptions') + set sessionoptions-=localoptions + set sessionoptions-=options +endif + " Let me move beyond buffer text in visual block mode -if has('virtualedit') +if exists('+virtualedit') set virtualedit+=block endif @@ -186,7 +182,9 @@ nnoremap " Remap normal/visual & to preserve substitution flags nnoremap & :&& -silent! xnoremap & :&& +if exists(':xnoremap') + xnoremap & :&& +endif " Cycle through argument list nnoremap [a :previous @@ -274,7 +272,9 @@ nnoremap V :let b: t: w: nnoremap w :setlocal wrap! wrap? " \x strips trailing whitespace via a custom plugin nmap x :StripTrailingWhitespace -silent! xmap x :StripTrailingWhitespace +if exists(':xmap') + xmap x :StripTrailingWhitespace +endif " \y shows all registers nnoremap y :registers " \z sets NZ English spelling (compare \u) -- cgit v1.2.3