Move setting default tabstop to sensible part

This commit is contained in:
Adam Stankiewicz
2020-12-29 20:42:08 +01:00
parent c5625ffedd
commit 4b54ae9cd9

View File

@@ -2670,18 +2670,34 @@ au FileType * au! polyglot-observer
augroup END augroup END
if !has_key(g:polyglot_is_disabled, 'autoindent') if !has_key(g:polyglot_is_disabled, 'sensible')
" Code below re-implements sleuth for vim-polyglot " Use 2-spaces tab indentation by default
let g:loaded_sleuth = 1
if &tabstop == 8 if &tabstop == 8
let &tabstop = 2 let &tabstop = 2
endif endif
" Set shiftwidth to proper value as users often mix it with tabstop
if &shiftwidth > &tabstop if &shiftwidth > &tabstop
let &shiftwidth = &tabstop let &shiftwidth = &tabstop
endif 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 let s:default_shiftwidth = &shiftwidth
func! s:get_shiftwidth(indents) abort func! s:get_shiftwidth(indents) abort
@@ -3559,20 +3575,6 @@ endfunc
" We want vim-polyglot files to load only as fallback " We want vim-polyglot files to load only as fallback
let &rtp = join(s:process_rtp(split(&rtp, ',')), ',') 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' " Restore 'cpoptions'
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save