summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-09-09 18:07:03 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-09-09 18:07:03 +0200
commit2dc954d6fa15c897da59ff14aa4d5991a3329eb5 (patch)
treebbb199ed31a4e5585a70591744bf61ffbd83d61c
parent2369cd5d2290c97b69a540dd88222a4ddcb1fe14 (diff)
downloadvim-polyglot-2dc954d6fa15c897da59ff14aa4d5991a3329eb5.tar.gz
vim-polyglot-2dc954d6fa15c897da59ff14aa4d5991a3329eb5.zip
Last fixes to b:sleuth_culprit
-rw-r--r--ftdetect/polyglot.vim7
1 files changed, 5 insertions, 2 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index f44a1959..ee74a293 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -1887,7 +1887,6 @@ if !has_key(s:disabled_packages, 'autoindent')
return 1
endif
- unlet b:sleuth_culprit
return 0
endfunction
@@ -1910,13 +1909,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))
@@ -1928,6 +1929,8 @@ if !has_key(s:disabled_packages, 'autoindent')
let dir = fnamemodify(dir, ':h')
let level -= 1
endwhile
+
+ unlet b:sleuth_culprit
endfunction
setglobal smarttab