Add option g:indent_guides_exclude_filetypes.

For specifying a list of filetypes to disable the plugin for.

Closes #20 and #26.
This commit is contained in:
Nate Kane 2013-03-06 21:57:33 +10:00
parent 0421be28b3
commit 997bede1b5
3 changed files with 33 additions and 1 deletions

View File

@ -33,6 +33,11 @@ endfunction
function! indent_guides#enable()
let g:indent_guides_autocmds_enabled = 1
if indent_guides#exclude_filetype()
call indent_guides#clear_matches()
return
end
call indent_guides#init_script_vars()
call indent_guides#highlight_colors()
call indent_guides#clear_matches()
@ -261,3 +266,15 @@ function! indent_guides#indent_highlight_pattern(indent_pattern, column_start, i
let l:pattern .= '\ze'
return l:pattern
endfunction
"
" Detect if any of the buffer filetypes should be excluded.
"
function! indent_guides#exclude_filetype()
for ft in split(&ft, ',')
if index(g:indent_guides_exclude_filetypes, ft) > -1
return 1
end
endfor
return 0
endfunction

View File

@ -150,6 +150,15 @@ Default: 0. Values: 0 or 1.
let g:indent_guides_enable_on_vim_startup = 0
<
------------------------------------------------------------------------------
*'indent_guides_exclude_filetypes'*
Use this option to specify a list of filetypes to disable the plugin for.
Default: ['help']. Values: list of strings.
>
let g:indent_guides_exclude_filetypes = ['help', 'nerdtree']
<
==============================================================================
4. MAPPINGS *indent-guides-mappings*
@ -228,6 +237,8 @@ Bug reports, feedback, suggestions etc are welcomed.
1.7 (pending release)~
* Added way to override the default mapping (thanks xuhdev).
* Added option g:|indent_guides_exclude_filetypes| to specify a list of
filetypes to disable the plugin for.
1.6~
* Added option g:|indent_guides_space_guides| to control whether spaces are

View File

@ -54,6 +54,10 @@ call s:InitVariable('g:indent_guides_enable_on_vim_startup', 0 )
call s:InitVariable('g:indent_guides_debug', 0 )
call s:InitVariable('g:indent_guides_space_guides', 1 )
if !exists('g:indent_guides_exclude_filetypes')
let g:indent_guides_exclude_filetypes = ['help']
endif
" Default mapping
if !hasmapto('<Plug>IndentGuidesToggle', 'n') && maparg('<Leader>ig', 'n') == ''
nmap <silent><unique> <Leader>ig <Plug>IndentGuidesToggle
@ -72,7 +76,7 @@ augroup indent_guides
autocmd VimEnter * :IndentGuidesEnable
endif
autocmd BufEnter,WinEnter * call indent_guides#process_autocmds()
autocmd BufEnter,WinEnter,FileType * call indent_guides#process_autocmds()
" Trigger BufEnter and process modelines.
autocmd ColorScheme * doautocmd indent_guides BufEnter