Vim file indent type autodetection
This commit is contained in:
parent
49ec5447e2
commit
b809746777
1 changed files with 9 additions and 0 deletions
9
vimrc
9
vimrc
|
@ -454,3 +454,12 @@ function! ShowModeInStatusLine()
|
||||||
endif
|
endif
|
||||||
return g:showMode
|
return g:showMode
|
||||||
endfunction
|
endfunction
|
||||||
|
"[Autodetect indent style of a file]"
|
||||||
|
function AutoDetectTabs()
|
||||||
|
if len(filter(getbufline(winbufnr(0), 1, "$"), 'v:val =~ "^\\t"')) > len(filter(getbufline(winbufnr(0), 1, "$"), 'v:val =~ "^ "'))
|
||||||
|
set noet ts=4 sw=4
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
if has("autocmd")
|
||||||
|
autocmd BufReadPost * call AutoDetectTabs()
|
||||||
|
endif
|
||||||
|
|
Loading…
Reference in a new issue