From 68a874cf7d51f0a58a522be2a35b08ac09d77207 Mon Sep 17 00:00:00 2001 From: Cong Ling Date: Tue, 5 Mar 2013 21:51:26 +0800 Subject: [PATCH] Change the type of the variables for "FileType Supported" to list --- after/plugin/indentLine.vim | 14 +++++++++----- doc/indentLine.txt | 12 ++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/after/plugin/indentLine.vim b/after/plugin/indentLine.vim index dfd9e2a..4b69d83 100644 --- a/after/plugin/indentLine.vim +++ b/after/plugin/indentLine.vim @@ -29,11 +29,11 @@ if !exists("g:indentLine_enabled") endif if !exists("g:indentLine_fileType") - let g:indentLine_fileType = "*" + let g:indentLine_fileType = [] endif if !exists("g:indentLine_fileTypeExclude") - let g:indentLine_fileTypeExclude = "" + let g:indentLine_fileTypeExclude = [] endif set conceallevel=1 @@ -105,10 +105,14 @@ function! Setup() if !exists("b:indentLine_set") let b:indentLine_set = 1 - if !empty(filter(split(g:indentLine_fileTypeExclude, ','), 'v:val ==? "*.".expand("%:e:e") || v:val == "*"')) + if index(g:indentLine_fileTypeExclude, &ft) != -1 return endif + if len(g:indentLine_fileType) != 0 && index(g:indentLine_fileType, &ft) == -1 + return + end + if !exists("b:indentLine_enabled") let b:indentLine_enabled = g:indentLine_enabled endif @@ -124,8 +128,8 @@ function! Setup() endfunction "{{{1 commands -exec 'autocmd BufWinEnter '.g:indentLine_fileType.' call Setup()' -exec 'autocmd BufRead,ColorScheme '.g:indentLine_fileType.' call InitColor()' +exec 'autocmd BufWinEnter * call Setup()' +exec 'autocmd BufRead,ColorScheme * call InitColor()' command! -nargs=? IndentLinesReset call ResetWidth() command! IndentLinesToggle call IndentLinesToggle() diff --git a/doc/indentLine.txt b/doc/indentLine.txt index 47cc12c..0be7b0a 100644 --- a/doc/indentLine.txt +++ b/doc/indentLine.txt @@ -51,18 +51,18 @@ g:indentLine_enabled *g:indentLine_enabled* Default value is 1. g:indentLine_fileType *g:indentLine_fileType* - This variable specify a list of comma separated file types. + This variable specify a list of file types. When opening these types of files, the plugin is enabled by default. - e.g. let g:indentLine_fileType = '*.c,*.h' - Default value is "*" which means all file types is supported. + e.g. let g:indentLine_fileType = ['c', 'cpp'] + Default value is [] which means all file types is supported. g:indentLine_fileTypeExclude *g:indentLine_fileTypeExclude* - This variable specify a list of comma separated file types. + This variable specify a list of file types. When opening these types of files, the plugin is disabled by default. - e.g. let g:indentLine_fileType = '*.txt,*.sh' - Default value is "" which means no file types is excluded. + e.g. let g:indentLine_fileType = ['text', 'sh'] + Default value is [] which means no file types is excluded. ============================================================================== COMMANDS *indentLine-commands*