mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 03:53: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
|
let spaces_minus_tabs = 0
|
||||||
|
|
||||||
for line in a:lines
|
for line in a:lines
|
||||||
if !len(line) || line =~# '^\s*$'
|
if !len(line) || line =~# '^\W*$'
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -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] == "."
|
||||||
@@ -157,10 +161,6 @@ endfunction
|
|||||||
|
|
||||||
setglobal smarttab
|
setglobal smarttab
|
||||||
|
|
||||||
if !exists('g:did_indent_on')
|
|
||||||
filetype indent on
|
|
||||||
endif
|
|
||||||
|
|
||||||
augroup polyglot
|
augroup polyglot
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType * call s:detect_indent()
|
autocmd FileType * call s:detect_indent()
|
||||||
|
|||||||
Reference in New Issue
Block a user