Don't overwrite settings from vimrc

This commit is contained in:
alexbel 2013-03-12 19:26:51 -04:00
parent 25ee2ece3d
commit d12f6d6d08
2 changed files with 16 additions and 5 deletions

View File

@ -73,6 +73,12 @@ let g:formatprg_args_cs = "--mode=cs --style=ansi -p -c -H"
``` ```
The default tabwidth is set to 4 for all formatprograms as well as for vim itself. The default tabwidth is set to 4 for all formatprograms as well as for vim itself.
It overwrites *tabstop*, *softtabstop*, *shiftwidth* in vimrc. If you want to keep your settings, you have to use *g:autoformat_default* variable. For example:
```vim
let g:autoformat_default = 2
```
If you change the tabwidth for a certain formatprogram, I would suggest to change the indent options of vim correspondingly for that filetype. If you change the tabwidth for a certain formatprogram, I would suggest to change the indent options of vim correspondingly for that filetype.
```vim ```vim

View File

@ -35,9 +35,14 @@ if !exists("g:formatprg_args_javascript")
let g:formatprg_args_javascript = "-i" let g:formatprg_args_javascript = "-i"
endif endif
"Set default indent behaviour to match with the formatprg defaults "Set default indent behaviour to match with the formatprg defaults
set expandtab set expandtab
if !exists("g:autoformat_default")
set tabstop = 4 set tabstop = 4
set softtabstop = 4 set softtabstop = 4
set shiftwidth = 4 set shiftwidth = 4
else
execute "set tabstop=".g:autoformat_default
execute "set softtabstop=".g:autoformat_default
execute "set shiftwidth=".g:autoformat_default
endif