@@ -2670,18 +2670,34 @@ au FileType * au! polyglot-observer
2670
2670
augroup END
2671
2671
2672
2672
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
2677
2675
if &tabstop == 8
2678
2676
let &tabstop = 2
2679
2677
endif
2680
2678
2679
+ " Set shiftwidth to proper value as users often mix it with tabstop
2681
2680
if &shiftwidth > &tabstop
2682
2681
let &shiftwidth = &tabstop
2683
2682
endif
2684
2683
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
+
2685
2701
let s: default_shiftwidth = &shiftwidth
2686
2702
2687
2703
func ! s: get_shiftwidth (indents) abort
@@ -3559,20 +3575,6 @@ endfunc
3559
3575
" We want vim-polyglot files to load only as fallback
3560
3576
let &rtp = join (s: process_rtp (split (&rtp , ' ,' )), ' ,' )
3561
3577
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
-
3576
3578
" Restore 'cpoptions'
3577
3579
let &cpo = s: cpo_save
3578
3580
unlet s: cpo_save
0 commit comments