Added early support for terminal vim
This commit is contained in:
parent
0c0ac44889
commit
6d903df6e7
@ -32,11 +32,8 @@ endfunction
|
||||
"
|
||||
function! indent_guides#enable()
|
||||
let g:indent_guides_autocmds_enabled = 1
|
||||
call indent_guides#clear_matches()
|
||||
|
||||
if g:indent_guides_auto_colors
|
||||
call indent_guides#highlight_colors()
|
||||
endif
|
||||
call indent_guides#clear_matches()
|
||||
|
||||
" loop through each indent level and define a highlight pattern
|
||||
" will automagically figure out whether to use tabs or spaces
|
||||
@ -80,7 +77,45 @@ endfunction
|
||||
" Automagically calculates and defines the indent highlight colors.
|
||||
"
|
||||
function! indent_guides#highlight_colors()
|
||||
" define default highlights
|
||||
exe 'hi IndentGuidesOdd guibg=lightgrey ctermbg=1'
|
||||
exe 'hi IndentGuidesEven guibg=darkgrey ctermbg=0'
|
||||
|
||||
if g:indent_guides_auto_colors
|
||||
if has('gui_running')
|
||||
call indent_guides#gui_highlight_colors()
|
||||
else
|
||||
call indent_guides#cterm_highlight_colors()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Automagically calculates and defines the indent highlight colors for
|
||||
" terminal vim.
|
||||
"
|
||||
function! indent_guides#cterm_highlight_colors()
|
||||
let hi_search = indent_guides#capture_highlight('search')
|
||||
let pattern = "ctermbg=\\zs[0-9A-Za-z]\\+\\ze"
|
||||
let hi_search_ctermbg = ''
|
||||
|
||||
" capture the backgroud color from the search highlight
|
||||
if hi_search =~ pattern
|
||||
let hi_search_ctermbg = matchstr(hi_search, pattern)
|
||||
endif
|
||||
|
||||
if hi_search_ctermbg =~ "[0-9A-Za-z]\\+"
|
||||
" define the new highlights
|
||||
exe 'hi IndentGuidesOdd ctermbg=none'
|
||||
exe 'hi IndentGuidesEven ctermbg=' . hi_search_ctermbg
|
||||
end
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Automagically calculates and defines the indent highlight colors for gui
|
||||
" vim.
|
||||
"
|
||||
function! indent_guides#gui_highlight_colors()
|
||||
let hi_normal = indent_guides#capture_highlight('normal')
|
||||
let hex_pattern = 'guibg=\zs'. g:indent_guides_hex_color_pattern . '\ze'
|
||||
let name_pattern = "guibg='\\?\\zs[0-9A-Za-z ]\\+\\ze'\\?"
|
||||
@ -105,7 +140,6 @@ function! indent_guides#highlight_colors()
|
||||
exe 'hi IndentGuidesOdd guibg=' . hi_odd_bg
|
||||
exe 'hi IndentGuidesEven guibg=' . hi_even_bg
|
||||
end
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Author: Nate Kane <nathanaelkane AT gmail DOT com>
|
||||
" Homepage: http://github.com/nathanaelkane/vim-indent-guides
|
||||
|
||||
if exists('g:loaded_indent_guides') || &cp || !has('gui_running')
|
||||
if exists('g:loaded_indent_guides') || &cp
|
||||
finish
|
||||
endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user