diff options
-rw-r--r-- | vim/after/indent/vim.vim | 4 | ||||
-rw-r--r-- | vim/after/syntax/sh.vim | 12 | ||||
-rw-r--r-- | vim/autoload/detect_background.vim | 3 | ||||
-rw-r--r-- | vim/config/files.vim | 4 | ||||
-rw-r--r-- | vim/config/syntax.vim | 2 | ||||
-rw-r--r-- | vim/config/whitespace.vim | 3 | ||||
-rw-r--r-- | vim/indent/csv.vim | 3 | ||||
-rw-r--r-- | vim/indent/tsv.vim | 3 | ||||
-rw-r--r-- | vim/vimrc | 16 |
9 files changed, 33 insertions, 17 deletions
diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index 0cb1d397..bfd92aeb 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -2,6 +2,6 @@ setlocal shiftwidth=2 setlocal softtabstop=2 if exists('b:undo_indent') - let b:undo_indent = b:undo_indent - \ . '|setlocal shiftwidth< softtabstop<' + let s:ui = '|setlocal shiftwidth< softtabstop<' + let b:undo_indent = b:undo_indent . s:ui endif diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim index 08dbd857..026e4ebd 100644 --- a/vim/after/syntax/sh.vim +++ b/vim/after/syntax/sh.vim @@ -1,3 +1,9 @@ +" Support line continuation for this file +if &compatible + let s:cpoptions_save = &cpoptions + set cpoptions-=C +endif + " If we know we have another shell type, clear away the others completely, now " that core syntax/sh.vim is done prodding /bin/sh to determine the system " shell type (which I don't care about). @@ -210,3 +216,9 @@ 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/autoload/detect_background.vim b/vim/autoload/detect_background.vim index c010dc53..e4163a43 100644 --- a/vim/autoload/detect_background.vim +++ b/vim/autoload/detect_background.vim @@ -9,8 +9,7 @@ " Author: Tom Ryder <tom@sanctum.geek.nz> " License: Same as Vim itself " -if exists('g:loaded_detect_background') - \ || &compatible +if exists('g:loaded_detect_background') || &compatible finish endif let g:loaded_detect_background = 1 diff --git a/vim/config/files.vim b/vim/config/files.vim index 7a23b4c5..61c3b6cb 100644 --- a/vim/config/files.vim +++ b/vim/config/files.vim @@ -18,10 +18,6 @@ if has('file_in_path') set path=** endif -" Try Mac line-endings if UNIX or DOS don't make sense; this has never -" happened to me but who knows, it might one day -set fileformats+=mac - " If the Vim buffer for a file doesn't have any changes and Vim detects the " file has been altered, quietly update it set autoread diff --git a/vim/config/syntax.vim b/vim/config/syntax.vim index b493c0a9..00004e35 100644 --- a/vim/config/syntax.vim +++ b/vim/config/syntax.vim @@ -1,5 +1,5 @@ " Options dependent on the syntax feature -if has('syntax') +if has('syntax') && !has('g:syntax_on') " Use syntax highlighting with 100 lines of context silent! syntax enable diff --git a/vim/config/whitespace.vim b/vim/config/whitespace.vim index 981def81..0d985f15 100644 --- a/vim/config/whitespace.vim +++ b/vim/config/whitespace.vim @@ -1,5 +1,4 @@ -" Adopt the indent of the last line on new lines; interestingly, plugins that -" do clever things with indenting will often assume this is set +" Adopt the indent of the last line on new lines set autoindent " Use spaces instead of tabs diff --git a/vim/indent/csv.vim b/vim/indent/csv.vim index d092838f..938bc99d 100644 --- a/vim/indent/csv.vim +++ b/vim/indent/csv.vim @@ -7,5 +7,4 @@ let b:did_indent = 1 " Manual indenting and literal tabs for CSVs setlocal noautoindent setlocal noexpandtab -let b:undo_indent - \ = 'setlocal autoindent< expandtab<' +let b:undo_indent = 'setlocal autoindent< expandtab<' diff --git a/vim/indent/tsv.vim b/vim/indent/tsv.vim index 56721a4c..6f70276d 100644 --- a/vim/indent/tsv.vim +++ b/vim/indent/tsv.vim @@ -7,5 +7,4 @@ let b:did_indent = 1 " Manual indenting and literal tabs for TSVs setlocal noautoindent setlocal noexpandtab -let b:undo_indent - \ = 'setlocal autoindent< expandtab<' +let b:undo_indent = 'setlocal autoindent< expandtab<' @@ -1,5 +1,10 @@ -" Don't try to be vi-compatible, even if invoked as ex or with -u specified -set nocompatible +" If we're in compatible mode, ensure that the 'C' option that disallows line +" continuations is stripped out, as they're heavily used in this +" configuration for readability; we'll put it back later +if &compatible + let s:cpoptions_save = &cpoptions + set cpoptions-=C +endif " Use different keys for global and local leaders if has('eval') @@ -29,3 +34,10 @@ if v:version >= 701 silent! colorscheme sahara endif endif + +" If we're in compatible mode, put 'cpoptions' back the way we found it at the +" start of this configuration, even though it's the current year +if exists('s:cpoptions_save') + let &cpoptions = s:cpoptions_save + unlet s:cpoptions_save +endif |