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:
parent
0421be28b3
commit
997bede1b5
@ -33,6 +33,11 @@ endfunction
|
|||||||
function! indent_guides#enable()
|
function! indent_guides#enable()
|
||||||
let g:indent_guides_autocmds_enabled = 1
|
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#init_script_vars()
|
||||||
call indent_guides#highlight_colors()
|
call indent_guides#highlight_colors()
|
||||||
call indent_guides#clear_matches()
|
call indent_guides#clear_matches()
|
||||||
@ -261,3 +266,15 @@ function! indent_guides#indent_highlight_pattern(indent_pattern, column_start, i
|
|||||||
let l:pattern .= '\ze'
|
let l:pattern .= '\ze'
|
||||||
return l:pattern
|
return l:pattern
|
||||||
endfunction
|
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
|
||||||
|
@ -150,6 +150,15 @@ Default: 0. Values: 0 or 1.
|
|||||||
let g:indent_guides_enable_on_vim_startup = 0
|
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*
|
4. MAPPINGS *indent-guides-mappings*
|
||||||
|
|
||||||
@ -228,6 +237,8 @@ Bug reports, feedback, suggestions etc are welcomed.
|
|||||||
|
|
||||||
1.7 (pending release)~
|
1.7 (pending release)~
|
||||||
* Added way to override the default mapping (thanks xuhdev).
|
* 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~
|
1.6~
|
||||||
* Added option g:|indent_guides_space_guides| to control whether spaces are
|
* Added option g:|indent_guides_space_guides| to control whether spaces are
|
||||||
|
@ -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_debug', 0 )
|
||||||
call s:InitVariable('g:indent_guides_space_guides', 1 )
|
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
|
" Default mapping
|
||||||
if !hasmapto('<Plug>IndentGuidesToggle', 'n') && maparg('<Leader>ig', 'n') == ''
|
if !hasmapto('<Plug>IndentGuidesToggle', 'n') && maparg('<Leader>ig', 'n') == ''
|
||||||
nmap <silent><unique> <Leader>ig <Plug>IndentGuidesToggle
|
nmap <silent><unique> <Leader>ig <Plug>IndentGuidesToggle
|
||||||
@ -72,7 +76,7 @@ augroup indent_guides
|
|||||||
autocmd VimEnter * :IndentGuidesEnable
|
autocmd VimEnter * :IndentGuidesEnable
|
||||||
endif
|
endif
|
||||||
|
|
||||||
autocmd BufEnter,WinEnter * call indent_guides#process_autocmds()
|
autocmd BufEnter,WinEnter,FileType * call indent_guides#process_autocmds()
|
||||||
|
|
||||||
" Trigger BufEnter and process modelines.
|
" Trigger BufEnter and process modelines.
|
||||||
autocmd ColorScheme * doautocmd indent_guides BufEnter
|
autocmd ColorScheme * doautocmd indent_guides BufEnter
|
||||||
|
Loading…
Reference in New Issue
Block a user