mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-10 20:43:52 -05:00
Fix disabling autoindent, closes #541
This commit is contained in:
@@ -1777,20 +1777,17 @@ au BufNewFile,BufRead,StdinReadPost *
|
|||||||
\ | call polyglot#Heuristics() | endif
|
\ | call polyglot#Heuristics() | endif
|
||||||
|
|
||||||
|
|
||||||
if v:version < 700 || &cp
|
if !has_key(s:disabled_packages, 'helm')
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
" Code below re-implements sleuth for vim-polyglot
|
||||||
|
let g:loaded_sleuth = 1
|
||||||
|
|
||||||
" Code below re-implements sleuth for vim-polyglot
|
" Makes shiftwidth to be synchronized with tabstop by default
|
||||||
let g:loaded_sleuth = 1
|
if &shiftwidth == &tabstop
|
||||||
|
|
||||||
" Makes shiftwidth to be synchronized with tabstop by default
|
|
||||||
if &shiftwidth == &tabstop
|
|
||||||
let &shiftwidth = 0
|
let &shiftwidth = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:guess(lines) abort
|
function! s:guess(lines) abort
|
||||||
let options = {}
|
let options = {}
|
||||||
let ccomment = 0
|
let ccomment = 0
|
||||||
let podcomment = 0
|
let podcomment = 0
|
||||||
@@ -1886,9 +1883,9 @@ function! s:guess(lines) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:detect_indent() abort
|
function! s:detect_indent() abort
|
||||||
if &buftype ==# 'help'
|
if &buftype ==# 'help'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -1923,14 +1920,15 @@ function! s:detect_indent() abort
|
|||||||
let dir = fnamemodify(dir, ':h')
|
let dir = fnamemodify(dir, ':h')
|
||||||
let level -= 1
|
let level -= 1
|
||||||
endwhile
|
endwhile
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
setglobal smarttab
|
setglobal smarttab
|
||||||
|
|
||||||
augroup polyglot
|
augroup polyglot
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType * call s:detect_indent()
|
autocmd FileType * call s:detect_indent()
|
||||||
augroup END
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
" restore Vi compatibility settings
|
" restore Vi compatibility settings
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
|
|||||||
Reference in New Issue
Block a user