1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-24 10:47:07 +08:00

fix(highlight): fix Tab key binding

This commit is contained in:
wsdjeg 2022-04-08 14:28:36 +08:00
parent 2452a1e86a
commit d799b3d49d

View File

@ -93,6 +93,13 @@ let s:hi_info = [
\ 'ctermbg' : '',
\ 'ctermfg' : 109,
\ 'bold' : 1,
\ },{
\ 'name' : 'HiInactive',
\ 'guibg' : '#3c3836',
\ 'guifg' : '#abb2bf',
\ 'ctermbg' : '',
\ 'ctermfg' : 145,
\ 'bold' : 1,
\ }
\ ]
@ -305,16 +312,23 @@ endfunction
" local func: highlight symbol {{{
function! s:highlight() abort
let s:highlight_id = []
for item in s:cursor_stack
call add(s:highlight_id, s:CMP.matchaddpos('HiBlueBold', [[
if item.active
call s:CMP.matchaddpos('HiBlueBold', [[
\ item.lnum,
\ item.col,
\ item.len
\ ]]))
\ ]])
else
call s:CMP.matchaddpos('HiInactive', [[
\ item.lnum,
\ item.col,
\ item.len
\ ]])
endif
endfor
if !empty(get(s:cursor_stack, s:index, []))
let s:highlight_id_c = s:CMP.matchaddpos('HiPurpleBold', [[
if !empty(get(s:cursor_stack, s:index, [])) && s:cursor_stack[s:index].active
call s:CMP.matchaddpos('HiPurpleBold', [[
\ s:cursor_stack[s:index].lnum,
\ s:cursor_stack[s:index].col,
\ s:cursor_stack[s:index].len,
@ -325,16 +339,13 @@ endfunction
" local func: clear highlight {{{
function! s:clear_highlight() abort
for id in s:highlight_id
call matchdelete(id)
endfor
call matchdelete(s:highlight_id_c)
call clearmatches()
endfunction
" }}}
" key binding: Tab toggle_item {{{
function! s:toggle_item() abort
let s:cursor_stack[s:index].active = s:cursor_stack[s:index].active ? 0 : 1
endfunction
" }}}