Improved support for terminal vim
This commit is contained in:
parent
6d903df6e7
commit
14aae71298
@ -77,10 +77,6 @@ endfunction
|
|||||||
" Automagically calculates and defines the indent highlight colors.
|
" Automagically calculates and defines the indent highlight colors.
|
||||||
"
|
"
|
||||||
function! indent_guides#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 g:indent_guides_auto_colors
|
||||||
if has('gui_running')
|
if has('gui_running')
|
||||||
call indent_guides#gui_highlight_colors()
|
call indent_guides#gui_highlight_colors()
|
||||||
@ -95,20 +91,23 @@ endfunction
|
|||||||
" terminal vim.
|
" terminal vim.
|
||||||
"
|
"
|
||||||
function! indent_guides#cterm_highlight_colors()
|
function! indent_guides#cterm_highlight_colors()
|
||||||
let hi_search = indent_guides#capture_highlight('search')
|
let hi_search = indent_guides#capture_highlight('Search')
|
||||||
let pattern = "ctermbg=\\zs[0-9A-Za-z]\\+\\ze"
|
let ctermfg_pattern = "ctermfg=\\zs[0-9A-Za-z]\\+\\ze"
|
||||||
|
let ctermbg_pattern = "ctermbg=\\zs[0-9A-Za-z]\\+\\ze"
|
||||||
|
let hi_search_ctermfg = ''
|
||||||
let hi_search_ctermbg = ''
|
let hi_search_ctermbg = ''
|
||||||
|
|
||||||
" capture the backgroud color from the search highlight
|
" capture the foreground color from the search highlight
|
||||||
if hi_search =~ pattern
|
if hi_search =~ ctermfg_pattern
|
||||||
let hi_search_ctermbg = matchstr(hi_search, pattern)
|
let hi_search_ctermfg = matchstr(hi_search, ctermfg_pattern)
|
||||||
|
exe 'hi IndentGuidesOdd ctermbg=' . hi_search_ctermfg
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if hi_search_ctermbg =~ "[0-9A-Za-z]\\+"
|
" capture the background color from the search highlight
|
||||||
" define the new highlights
|
if hi_search =~ ctermbg_pattern
|
||||||
exe 'hi IndentGuidesOdd ctermbg=none'
|
let hi_search_ctermbg = matchstr(hi_search, ctermbg_pattern)
|
||||||
exe 'hi IndentGuidesEven ctermbg=' . hi_search_ctermbg
|
exe 'hi IndentGuidesEven ctermbg=' . hi_search_ctermbg
|
||||||
end
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"
|
"
|
||||||
@ -116,7 +115,7 @@ endfunction
|
|||||||
" vim.
|
" vim.
|
||||||
"
|
"
|
||||||
function! indent_guides#gui_highlight_colors()
|
function! indent_guides#gui_highlight_colors()
|
||||||
let hi_normal = indent_guides#capture_highlight('normal')
|
let hi_normal = indent_guides#capture_highlight('Normal')
|
||||||
let hex_pattern = 'guibg=\zs'. g:indent_guides_hex_color_pattern . '\ze'
|
let hex_pattern = 'guibg=\zs'. g:indent_guides_hex_color_pattern . '\ze'
|
||||||
let name_pattern = "guibg='\\?\\zs[0-9A-Za-z ]\\+\\ze'\\?"
|
let name_pattern = "guibg='\\?\\zs[0-9A-Za-z ]\\+\\ze'\\?"
|
||||||
let hi_normal_guibg = ''
|
let hi_normal_guibg = ''
|
||||||
@ -178,3 +177,11 @@ function! indent_guides#init_matches()
|
|||||||
\ exists('w:indent_guides_matches') ? w:indent_guides_matches : []
|
\ exists('w:indent_guides_matches') ? w:indent_guides_matches : []
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
"
|
||||||
|
" Define default highlights.
|
||||||
|
"
|
||||||
|
function! indent_guides#define_default_highlights()
|
||||||
|
exe 'hi IndentGuidesOdd guibg=none ctermbg=none'
|
||||||
|
exe 'hi IndentGuidesEven guibg=none ctermbg=none'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
if exists('g:loaded_indent_guides') || &cp
|
if exists('g:loaded_indent_guides') || &cp
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:loaded_indent_guides = 1
|
let g:loaded_indent_guides = 1
|
||||||
|
call indent_guides#define_default_highlights()
|
||||||
|
|
||||||
function! s:IndentGuidesToggle()
|
function! s:IndentGuidesToggle()
|
||||||
call indent_guides#toggle()
|
call indent_guides#toggle()
|
||||||
|
Loading…
Reference in New Issue
Block a user