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 'Raimondi/delimitMate'
Plugin 'tpope/vim-surround' Plugin 'tpope/vim-surround'
Plugin 'captbaritone/better-indent-support-for-php-with-html' Plugin 'captbaritone/better-indent-support-for-php-with-html'
Plugin 'luochen1990/indent-detector.vim'
"[Solarized theme]" "[Solarized theme]"
Plugin 'altercation/vim-colors-solarized' Plugin 'altercation/vim-colors-solarized'
call vundle#end() call vundle#end()
@ -289,7 +290,7 @@ language messages POSIX
set title set title
"[Hide/show the white-space and more invisible symbols]" "[Hide/show the white-space and more invisible symbols]"
set list set list
set listchars=tab:\|-,trail:- set listchars=tab:\|\-,trail:-
set nojoinspaces set nojoinspaces
"[Folding settings]" "[Folding settings]"
set foldenable set foldenable
@ -438,12 +439,12 @@ function! ShowModeInStatusLine()
endif endif
return g:showMode return g:showMode
endfunction endfunction
"[Autodetect indent style of a file]" ""[Autodetect indent style of a file]"
function AutoDetectTabs() "function AutoDetectTabs()
if len(filter(getbufline(winbufnr(0), 1, "$"), 'v:val =~ "^\\t"')) > len(filter(getbufline(winbufnr(0), 1, "$"), 'v:val =~ "^ "')) " if len(filter(getbufline(winbufnr(0), 1, "$"), 'v:val =~ "^\\t"')) > len(filter(getbufline(winbufnr(0), 1, "$"), 'v:val =~ "^ "'))
set noet ts=4 sw=4 " set noet ts=4 sw=4
endif " endif
endfunction "endfunction
if has("autocmd") "if has("autocmd")
autocmd BufReadPost * call AutoDetectTabs() " autocmd BufReadPost * call AutoDetectTabs()
endif "endif