Skip to content

Commit 4b54ae9

Browse files
committed
Move setting default tabstop to sensible part
1 parent c5625ff commit 4b54ae9

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

ftdetect/polyglot.vim

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,18 +2670,34 @@ au FileType * au! polyglot-observer
26702670
augroup END
26712671

26722672

2673-
if !has_key(g:polyglot_is_disabled, 'autoindent')
2674-
" Code below re-implements sleuth for vim-polyglot
2675-
let g:loaded_sleuth = 1
2676-
2673+
if !has_key(g:polyglot_is_disabled, 'sensible')
2674+
" Use 2-spaces tab indentation by default
26772675
if &tabstop == 8
26782676
let &tabstop = 2
26792677
endif
26802678

2679+
" Set shiftwidth to proper value as users often mix it with tabstop
26812680
if &shiftwidth > &tabstop
26822681
let &shiftwidth = &tabstop
26832682
endif
26842683

2684+
" Use utf-8 encoding by default
2685+
set encoding=utf-8
2686+
2687+
" Reload unchanged files automatically.
2688+
set autoread
2689+
2690+
" Disable swap, it doesn't play well with autoread
2691+
set noswapfile
2692+
2693+
" Autoindent when starting new line, or using `o` or `O`.
2694+
set autoindent
2695+
endif
2696+
2697+
if !has_key(g:polyglot_is_disabled, 'autoindent')
2698+
" Code below re-implements sleuth for vim-polyglot
2699+
let g:loaded_sleuth = 1
2700+
26852701
let s:default_shiftwidth = &shiftwidth
26862702

26872703
func! s:get_shiftwidth(indents) abort
@@ -3559,20 +3575,6 @@ endfunc
35593575
" We want vim-polyglot files to load only as fallback
35603576
let &rtp = join(s:process_rtp(split(&rtp, ',')), ',')
35613577

3562-
if !has_key(g:polyglot_is_disabled, 'sensible')
3563-
" Use utf-8 encoding by default
3564-
set encoding=utf-8
3565-
3566-
" Reload unchanged files automatically.
3567-
set autoread
3568-
3569-
" Disable swap, it doesn't play well with autoread
3570-
set noswapfile
3571-
3572-
" Autoindent when starting new line, or using `o` or `O`.
3573-
set autoindent
3574-
endif
3575-
35763578
" Restore 'cpoptions'
35773579
let &cpo = s:cpo_save
35783580
unlet s:cpo_save

0 commit comments

Comments
 (0)