mirror of
https://github.com/amix/vimrc
synced 2025-06-23 06:35:01 +08:00
Updated plugins
This commit is contained in:
@ -182,7 +182,7 @@ function! gitgutter#diff#handler(bufnr, diff) abort
|
||||
let modified_lines = gitgutter#diff#process_hunks(a:bufnr, gitgutter#hunk#hunks(a:bufnr))
|
||||
|
||||
let signs_count = len(modified_lines)
|
||||
if signs_count > g:gitgutter_max_signs
|
||||
if g:gitgutter_max_signs != -1 && signs_count > g:gitgutter_max_signs
|
||||
call gitgutter#utility#warn_once(a:bufnr, printf(
|
||||
\ 'exceeded maximum number of signs (%d > %d, configured by g:gitgutter_max_signs).',
|
||||
\ signs_count, g:gitgutter_max_signs), 'max_signs')
|
||||
|
@ -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
|
||||
|
@ -162,7 +162,7 @@ endfunction
|
||||
|
||||
|
||||
function! gitgutter#utility#cd_cmd(bufnr, cmd) abort
|
||||
let cd = s:unc_path(a:bufnr) ? 'pushd' : (gitgutter#utility#windows() ? 'cd /d' : 'cd')
|
||||
let cd = s:unc_path(a:bufnr) ? 'pushd' : (gitgutter#utility#windows() && s:dos_shell() ? 'cd /d' : 'cd')
|
||||
return cd.' '.s:dir(a:bufnr).' && '.a:cmd
|
||||
endfunction
|
||||
|
||||
@ -170,6 +170,10 @@ function! s:unc_path(bufnr)
|
||||
return s:abs_path(a:bufnr, 0) =~ '^\\\\'
|
||||
endfunction
|
||||
|
||||
function! s:dos_shell()
|
||||
return &shell == 'cmd.exe' || &shell == 'command.com'
|
||||
endfunction
|
||||
|
||||
function! s:use_known_shell() abort
|
||||
if has('unix') && &shell !=# 'sh'
|
||||
let [s:shell, s:shellcmdflag, s:shellredir] = [&shell, &shellcmdflag, &shellredir]
|
||||
|
Reference in New Issue
Block a user