diff options
Diffstat (limited to 'vim')
-rw-r--r-- | vim/after/indent/vim.vim | 11 | ||||
-rw-r--r-- | vim/vimrc | 17 |
2 files changed, 20 insertions, 8 deletions
diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index 6e2eb7f3..0767bca0 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -1,5 +1,5 @@ -" Remove inapplicable defaults from 'indentkeys' -" Should only need to undo this if the stock plugin didn't +" Remove inapplicable defaults from 'indentkeys'; we should only need to undo +" this if the stock plugin didn't already arrange that (before v7.3.539) setlocal indentkeys-=0#,0{,0},0),: if !exists('b:undo_indent') let b:undo_indent = 'setlocal indentkeys<' @@ -7,5 +7,8 @@ endif " Observe VimL conventions for two-space indents setlocal shiftwidth=2 -setlocal softtabstop=2 -let b:undo_indent .= '|setlocal shiftwidth< softtabstop<' +let b:undo_indent .= '|setlocal shiftwidth<' +if &softtabstop != -1 + let &l:softtabstop = &l:shiftwidth + let b:undo_indent .= '|setlocal softtabstop<' +endif @@ -32,10 +32,19 @@ catch endtry " The all-important default indent settings; filetypes to tweak -set autoindent " Use indent of previous line on new lines -set expandtab " Use spaces instead of tabs -set shiftwidth=4 " Indent with four spaces -set softtabstop=4 " Insert four spaces with tab key +set autoindent " Use indent of previous line on new lines +set expandtab " Use spaces instead of tabs +set shiftwidth=4 " Indent with four spaces + +" The number of spaces the Tab key should insert should follow 'shiftwidth'; +" if Vim is new enough (v7.3.693), use a negative value to automate this, +" otherwise just use its present value +if v:version > 703 + \ || v:version == 703 && has('patch693') + set softtabstop=-1 +else + let &softtabstop = &shiftwidth +endif " Let me backspace over pretty much anything set backspace+=eol " Line breaks |