Add indent detection

This commit is contained in:
lhark 2017-03-14 10:37:20 -04:00
parent b5eaf95863
commit 15255cc1a5

21
vimrc
View file

@ -70,6 +70,7 @@ if has("unix") || has("mac")
Plugin 'Raimondi/delimitMate'
Plugin 'tpope/vim-surround'
Plugin 'captbaritone/better-indent-support-for-php-with-html'
Plugin 'luochen1990/indent-detector.vim'
"[Solarized theme]"
Plugin 'altercation/vim-colors-solarized'
call vundle#end()
@ -289,7 +290,7 @@ language messages POSIX
set title
"[Hide/show the white-space and more invisible symbols]"
set list
set listchars=tab:\|-,trail:-
set listchars=tab:\|\-,trail:-
set nojoinspaces
"[Folding settings]"
set foldenable
@ -438,12 +439,12 @@ function! ShowModeInStatusLine()
endif
return g:showMode
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
""[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