mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 12:03:53 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19a69cf77d | ||
|
|
4f7a4036eb | ||
|
|
0ff5d451b0 | ||
|
|
49840b1893 | ||
|
|
2dc954d6fa | ||
|
|
2369cd5d22 |
@@ -1775,7 +1775,7 @@ endif
|
||||
" end filetypes
|
||||
|
||||
au BufNewFile,BufRead,StdinReadPost *
|
||||
\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
|
||||
\ if !did_filetype() && expand("<afile>") !~ g:ft_ignore_pat
|
||||
\ | call polyglot#Heuristics() | endif
|
||||
|
||||
|
||||
@@ -1799,8 +1799,11 @@ if !has_key(s:disabled_packages, 'autoindent')
|
||||
let heredoc = ''
|
||||
let minindent = 10
|
||||
let spaces_minus_tabs = 0
|
||||
let i = 0
|
||||
|
||||
for line in a:lines
|
||||
let i += 1
|
||||
|
||||
if !len(line) || line =~# '^\W*$'
|
||||
continue
|
||||
endif
|
||||
@@ -1869,12 +1872,13 @@ if !has_key(s:disabled_packages, 'autoindent')
|
||||
|
||||
if line[0] == "\t"
|
||||
setlocal noexpandtab
|
||||
let &shiftwidth=&tabstop
|
||||
let b:sleuth_culprit .= ':' . i
|
||||
return 1
|
||||
elseif line[0] == " "
|
||||
let indent = len(matchstr(line, '^ *'))
|
||||
if (indent % 2 == 0 || indent % 3 == 0) && indent < minindent
|
||||
let minindent = indent
|
||||
let b:sleuth_culprit .= ":" . line
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
@@ -1882,10 +1886,10 @@ if !has_key(s:disabled_packages, 'autoindent')
|
||||
if minindent < 10
|
||||
setlocal expandtab
|
||||
let &shiftwidth=minindent
|
||||
let b:sleuth_culprit .= ':' . i
|
||||
return 1
|
||||
endif
|
||||
|
||||
unlet b:sleuth_culprit
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
@@ -1894,7 +1898,7 @@ if !has_key(s:disabled_packages, 'autoindent')
|
||||
return
|
||||
endif
|
||||
|
||||
let b:sleuth_culprit = expand("<amatch>")
|
||||
let b:sleuth_culprit = expand("<afile>:p")
|
||||
if s:guess(getline(1, 32))
|
||||
return
|
||||
endif
|
||||
@@ -1908,13 +1912,15 @@ if !has_key(s:disabled_packages, 'autoindent')
|
||||
while isdirectory(dir) && dir !=# fnamemodify(dir, ':h') && level > 0
|
||||
" Ignore files from homedir and root
|
||||
if dir == expand('~') || dir == '/'
|
||||
unlet b:sleuth_culprit
|
||||
return
|
||||
endif
|
||||
for neighbor in glob(dir . '/' . pattern, 0, 1)[0:level]
|
||||
let b:sleuth_culprit = neighbor
|
||||
" Do not consider directories above .git, .svn or .hg
|
||||
if fnamemodify(neighbor, ":h:t")[0] == "."
|
||||
return
|
||||
let level = 0
|
||||
continue
|
||||
endif
|
||||
if neighbor !=# expand('%:p') && filereadable(neighbor)
|
||||
if s:guess(readfile(neighbor, '', 32))
|
||||
@@ -1926,6 +1932,8 @@ if !has_key(s:disabled_packages, 'autoindent')
|
||||
let dir = fnamemodify(dir, ':h')
|
||||
let level -= 1
|
||||
endwhile
|
||||
|
||||
unlet b:sleuth_culprit
|
||||
endfunction
|
||||
|
||||
setglobal smarttab
|
||||
|
||||
Reference in New Issue
Block a user