diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-12-29 20:42:08 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-12-29 20:42:17 +0100 |
commit | 4b54ae9cd98b658a828e10241ffca1015316639e (patch) | |
tree | 84379318a4c0e326f96ba5f7f58e918ff0d00026 | |
parent | c5625ffedd61a01de1399afef6fbcd31f5cda72f (diff) | |
download | vim-polyglot-4b54ae9cd98b658a828e10241ffca1015316639e.tar.gz vim-polyglot-4b54ae9cd98b658a828e10241ffca1015316639e.zip |
Move setting default tabstop to sensible part
-rw-r--r-- | ftdetect/polyglot.vim | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index ac934d53..3132a339 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -2670,18 +2670,34 @@ au FileType * au! polyglot-observer augroup END -if !has_key(g:polyglot_is_disabled, 'autoindent') - " Code below re-implements sleuth for vim-polyglot - let g:loaded_sleuth = 1 - +if !has_key(g:polyglot_is_disabled, 'sensible') + " Use 2-spaces tab indentation by default if &tabstop == 8 let &tabstop = 2 endif + " Set shiftwidth to proper value as users often mix it with tabstop if &shiftwidth > &tabstop let &shiftwidth = &tabstop endif + " Use utf-8 encoding by default + set encoding=utf-8 + + " Reload unchanged files automatically. + set autoread + + " Disable swap, it doesn't play well with autoread + set noswapfile + + " Autoindent when starting new line, or using `o` or `O`. + set autoindent +endif + +if !has_key(g:polyglot_is_disabled, 'autoindent') + " Code below re-implements sleuth for vim-polyglot + let g:loaded_sleuth = 1 + let s:default_shiftwidth = &shiftwidth func! s:get_shiftwidth(indents) abort @@ -3559,20 +3575,6 @@ endfunc " We want vim-polyglot files to load only as fallback let &rtp = join(s:process_rtp(split(&rtp, ',')), ',') -if !has_key(g:polyglot_is_disabled, 'sensible') - " Use utf-8 encoding by default - set encoding=utf-8 - - " Reload unchanged files automatically. - set autoread - - " Disable swap, it doesn't play well with autoread - set noswapfile - - " Autoindent when starting new line, or using `o` or `O`. - set autoindent -endif - " Restore 'cpoptions' let &cpo = s:cpo_save unlet s:cpo_save |