diff --git a/README.markdown b/README.markdown index 20aabc6..2a562b4 100644 --- a/README.markdown +++ b/README.markdown @@ -72,7 +72,13 @@ let g:formatprg_cs = "astyle" 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. ```vim diff --git a/plugin/defaults.vim b/plugin/defaults.vim index 60802cc..78785a6 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -35,9 +35,14 @@ if !exists("g:formatprg_args_javascript") let g:formatprg_args_javascript = "-i" endif - "Set default indent behaviour to match with the formatprg defaults set expandtab -set tabstop=4 -set softtabstop=4 -set shiftwidth=4 +if !exists("g:autoformat_default") + set tabstop = 4 + set softtabstop = 4 + set shiftwidth = 4 +else + execute "set tabstop=".g:autoformat_default + execute "set softtabstop=".g:autoformat_default + execute "set shiftwidth=".g:autoformat_default +endif