mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0124dc880 | ||
|
|
99166bd51f | ||
|
|
48b4f233c5 |
@@ -36,7 +36,7 @@ function! s:guess(lines) abort
|
||||
let spaces_minus_tabs = 0
|
||||
|
||||
for line in a:lines
|
||||
if !len(line) || line =~# '^\s*$'
|
||||
if !len(line) || line =~# '^\W*$'
|
||||
continue
|
||||
endif
|
||||
|
||||
@@ -138,6 +138,10 @@ function! s:detect_indent() abort
|
||||
let dir = expand('%:p:h')
|
||||
let level = 3
|
||||
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]
|
||||
" Do not consider directories above .git, .svn or .hg
|
||||
if fnamemodify(neighbor, ":h:t")[0] == "."
|
||||
@@ -157,10 +161,6 @@ endfunction
|
||||
|
||||
setglobal smarttab
|
||||
|
||||
if !exists('g:did_indent_on')
|
||||
filetype indent on
|
||||
endif
|
||||
|
||||
augroup polyglot
|
||||
autocmd!
|
||||
autocmd FileType * call s:detect_indent()
|
||||
|
||||
Reference in New Issue
Block a user