mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -64,14 +64,6 @@ function! gitgutter#highlight#linenr_toggle() abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! gitgutter#highlight#define_sign_column_highlight() abort
|
||||
if g:gitgutter_override_sign_column_highlight
|
||||
highlight! link SignColumn LineNr
|
||||
else
|
||||
highlight default link SignColumn LineNr
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! gitgutter#highlight#define_highlights() abort
|
||||
let [guibg, ctermbg] = s:get_background_colors('SignColumn')
|
||||
|
||||
@ -84,26 +76,24 @@ function! gitgutter#highlight#define_highlights() abort
|
||||
highlight default link GitGutterChangeDeleteInvisible GitGutterChangeInvisible
|
||||
|
||||
" When they are visible.
|
||||
|
||||
" If GitGutter* highlights are already defined, either by the user or the colourscheme,
|
||||
" set their backgrounds to the sign column's.
|
||||
for type in ["Add", "Change", "Delete"]
|
||||
if hlexists("GitGutter".type)
|
||||
" Were the highlight self-contained we could just declare the
|
||||
" background attributes and they would be merged. But it might be a
|
||||
" link, in which case it would be overwritten. So re-declare it in its
|
||||
" entirety.
|
||||
let [guifg, ctermfg] = s:get_foreground_colors('GitGutter'.type)
|
||||
execute "highlight GitGutter".type." guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg
|
||||
if g:gitgutter_set_sign_backgrounds
|
||||
execute "highlight GitGutter".type." guibg=".guibg." ctermbg=".ctermbg
|
||||
endif
|
||||
continue
|
||||
elseif s:useful_diff_colours()
|
||||
let [guifg, ctermfg] = s:get_foreground_colors('Diff'.type)
|
||||
else
|
||||
let [guifg, ctermfg] = s:get_foreground_fallback_colors(type)
|
||||
endif
|
||||
execute "highlight GitGutter".type." guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg
|
||||
endfor
|
||||
|
||||
" By default use Diff* foreground colors with SignColumn's background.
|
||||
for type in ['Add', 'Change', 'Delete']
|
||||
let [guifg, ctermfg] = s:get_foreground_colors('Diff'.type)
|
||||
execute "highlight GitGutter".type."Default guifg=".guifg." guibg=".guibg." ctermfg=".ctermfg." ctermbg=".ctermbg
|
||||
execute "highlight default link GitGutter".type." GitGutter".type."Default"
|
||||
endfor
|
||||
if hlexists("GitGutterChangeDelete") && g:gitgutter_set_sign_backgrounds
|
||||
execute "highlight GitGutterChangeDelete guibg=".guibg." ctermbg=".ctermbg
|
||||
endif
|
||||
|
||||
highlight default link GitGutterChangeDelete GitGutterChange
|
||||
|
||||
" Highlights used for the whole line.
|
||||
@ -236,3 +226,20 @@ function! s:get_background_colors(group) abort
|
||||
let guibg = s:get_hl(a:group, 'bg', 'gui')
|
||||
return [guibg, ctermbg]
|
||||
endfunction
|
||||
|
||||
function! s:useful_diff_colours()
|
||||
let [guifg_add, ctermfg_add] = s:get_foreground_colors('DiffAdd')
|
||||
let [guifg_del, ctermfg_del] = s:get_foreground_colors('DiffDelete')
|
||||
|
||||
return guifg_add != guifg_del && ctermfg_add != ctermfg_del
|
||||
endfunction
|
||||
|
||||
function! s:get_foreground_fallback_colors(type)
|
||||
if a:type == 'Add'
|
||||
return ['#009900', '2']
|
||||
elseif a:type == 'Change'
|
||||
return ['#bbbb00', '3']
|
||||
elseif a:type == 'Delete'
|
||||
return ['#ff2222', '1']
|
||||
endif
|
||||
endfunction
|
||||
|
Reference in New Issue
Block a user