Ignore files from homedir and root for indent

https://github.com/tpope/vim-sleuth/pull/57
This commit is contained in:
Adam Stankiewicz
2020-09-04 19:45:47 +02:00
parent 99166bd51f
commit b0124dc880

View File

@@ -138,6 +138,10 @@ function! s:detect_indent() abort
let dir = expand('%:p:h') let dir = expand('%:p:h')
let level = 3 let level = 3
while isdirectory(dir) && dir !=# fnamemodify(dir, ':h') && level > 0 while isdirectory(dir) && dir !=# fnamemodify(dir, ':h') && level > 0
" Ignore files from homedir and root
if dir == expand('~') || dir == '/'
return
endif
for neighbor in glob(dir . '/' . pattern, 0, 1)[0:level] for neighbor in glob(dir . '/' . pattern, 0, 1)[0:level]
" Do not consider directories above .git, .svn or .hg " Do not consider directories above .git, .svn or .hg
if fnamemodify(neighbor, ":h:t")[0] == "." if fnamemodify(neighbor, ":h:t")[0] == "."