mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Ignore files from homedir and root for indent
https://github.com/tpope/vim-sleuth/pull/57
This commit is contained in:
@@ -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] == "."
|
||||||
|
|||||||
Reference in New Issue
Block a user