mirror of
https://github.com/amix/vimrc
synced 2025-07-04 15:04:59 +08:00
Update plugins using update_plugins.py
This commit is contained in:
@ -2,7 +2,3 @@
|
||||
|
||||
> What vim/nvim version are you on?
|
||||
|
||||
> If no signs are showing at all, what does `:echo b:gitgutter.path` give?
|
||||
|
||||
> If no signs are showing at all, and the `path` value is a path and not `-2`, does it work with `let g:gitgutter_grep=''`?
|
||||
|
||||
|
@ -26,7 +26,7 @@ Features:
|
||||
Constraints:
|
||||
|
||||
* Supports git only. If you work with other version control systems, I recommend [vim-signify](https://github.com/mhinz/vim-signify).
|
||||
* Relies on the `FocusGained` event. If your terminal doesn't report focus events, either use something like [Terminus][] or set `let g:gitgutter_terminal_reports_focus=0`. For tmux, `set -f focus-events on` in your tmux.conf.
|
||||
* Relies on the `FocusGained` event. If your terminal doesn't report focus events, either use something like [Terminus][] or set `let g:gitgutter_terminal_reports_focus=0`. For tmux, `set -g focus-events on` in your tmux.conf.
|
||||
|
||||
|
||||
### Screenshot
|
||||
@ -557,7 +557,7 @@ Here are some things you can check:
|
||||
|
||||
#### When signs don't update after focusing Vim
|
||||
|
||||
* Your terminal probably isn't reporting focus events. Either try installing [Terminus][] or set `let g:gitgutter_terminal_reports_focus=0`. For tmux, try `set -f focus-events on` in your tmux.conf.
|
||||
* Your terminal probably isn't reporting focus events. Either try installing [Terminus][] or set `let g:gitgutter_terminal_reports_focus=0`. For tmux, try `set -g focus-events on` in your tmux.conf.
|
||||
|
||||
|
||||
### Shameless Plug
|
||||
|
@ -173,4 +173,5 @@ function! s:clear(bufnr)
|
||||
call gitgutter#sign#remove_dummy_sign(a:bufnr, 1)
|
||||
call gitgutter#hunk#reset(a:bufnr)
|
||||
call s:reset_tick(a:bufnr)
|
||||
call gitgutter#utility#setbufvar(a:bufnr, 'path', '')
|
||||
endfunction
|
||||
|
@ -4,7 +4,7 @@ let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
|
||||
|
||||
" True for git v1.7.2+.
|
||||
function! s:git_supports_command_line_config_override() abort
|
||||
call system(g:gitgutter_git_executable.' -c foo.bar=baz --version')
|
||||
call system(g:gitgutter_git_executable.' '.g:gitgutter_git_args.' -c foo.bar=baz --version')
|
||||
return !v:shell_error
|
||||
endfunction
|
||||
|
||||
@ -119,14 +119,14 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
|
||||
|
||||
" Write file from index to temporary file.
|
||||
let index_name = g:gitgutter_diff_base.':'.gitgutter#utility#repo_path(a:bufnr, 1)
|
||||
let cmd .= g:gitgutter_git_executable.' --no-pager show '.index_name.' > '.from_file.' && '
|
||||
let cmd .= g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager show '.index_name.' > '.from_file.' && '
|
||||
|
||||
elseif a:from ==# 'working_tree'
|
||||
let from_file = gitgutter#utility#repo_path(a:bufnr, 1)
|
||||
endif
|
||||
|
||||
" Call git-diff.
|
||||
let cmd .= g:gitgutter_git_executable.' --no-pager '.g:gitgutter_git_args
|
||||
let cmd .= g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager '.g:gitgutter_git_args
|
||||
if s:c_flag
|
||||
let cmd .= ' -c "diff.autorefreshindex=0"'
|
||||
let cmd .= ' -c "diff.noprefix=false"'
|
||||
|
@ -131,40 +131,22 @@ function! s:define_sign_line_highlights() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_foreground_colors(group) abort
|
||||
redir => highlight
|
||||
silent execute 'silent highlight ' . a:group
|
||||
redir END
|
||||
|
||||
let link_matches = matchlist(highlight, 'links to \(\S\+\)')
|
||||
if len(link_matches) > 0 " follow the link
|
||||
return s:get_foreground_colors(link_matches[1])
|
||||
function! s:get_hl(group, what, mode) abort
|
||||
let r = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode)
|
||||
if empty(r) || r == -1
|
||||
return 'NONE'
|
||||
endif
|
||||
return r
|
||||
endfunction
|
||||
|
||||
let ctermfg = s:match_highlight(highlight, 'ctermfg=\([0-9A-Za-z]\+\)')
|
||||
let guifg = s:match_highlight(highlight, 'guifg=\([#0-9A-Za-z]\+\)')
|
||||
function! s:get_foreground_colors(group) abort
|
||||
let ctermfg = s:get_hl(a:group, 'fg', 'cterm')
|
||||
let guifg = s:get_hl(a:group, 'fg', 'gui')
|
||||
return [guifg, ctermfg]
|
||||
endfunction
|
||||
|
||||
function! s:get_background_colors(group) abort
|
||||
redir => highlight
|
||||
silent execute 'silent highlight ' . a:group
|
||||
redir END
|
||||
|
||||
let link_matches = matchlist(highlight, 'links to \(\S\+\)')
|
||||
if len(link_matches) > 0 " follow the link
|
||||
return s:get_background_colors(link_matches[1])
|
||||
endif
|
||||
|
||||
let ctermbg = s:match_highlight(highlight, 'ctermbg=\([0-9A-Za-z]\+\)')
|
||||
let guibg = s:match_highlight(highlight, 'guibg=\([#0-9A-Za-z]\+\)')
|
||||
let ctermbg = s:get_hl(a:group, 'bg', 'cterm')
|
||||
let guibg = s:get_hl(a:group, 'bg', 'gui')
|
||||
return [guibg, ctermbg]
|
||||
endfunction
|
||||
|
||||
function! s:match_highlight(highlight, pattern) abort
|
||||
let matches = matchlist(a:highlight, a:pattern)
|
||||
if len(matches) == 0
|
||||
return 'NONE'
|
||||
endif
|
||||
return matches[1]
|
||||
endfunction
|
||||
|
@ -221,7 +221,7 @@ function! s:stage(hunk_diff)
|
||||
let diff = s:adjust_header(bufnr, a:hunk_diff)
|
||||
" Apply patch to index.
|
||||
call gitgutter#utility#system(
|
||||
\ gitgutter#utility#cd_cmd(bufnr, g:gitgutter_git_executable.' apply --cached --unidiff-zero - '),
|
||||
\ gitgutter#utility#cd_cmd(bufnr, g:gitgutter_git_executable.' '.g:gitgutter_git_args.' apply --cached --unidiff-zero - '),
|
||||
\ diff)
|
||||
|
||||
" Refresh gitgutter's view of buffer.
|
||||
@ -240,10 +240,10 @@ function! s:undo(hunk_diff)
|
||||
if removed_only
|
||||
call append(lnum, lines)
|
||||
elseif added_only
|
||||
execute lnum .','. (lnum+len(lines)-1) .'d'
|
||||
execute lnum .','. (lnum+len(lines)-1) .'d _'
|
||||
else
|
||||
call append(lnum-1, lines[0:hunk[1]])
|
||||
execute (lnum+hunk[1]) .','. (lnum+hunk[1]+hunk[3]) .'d'
|
||||
execute (lnum+hunk[1]) .','. (lnum+hunk[1]+hunk[3]) .'d _'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -22,14 +22,16 @@ function! gitgutter#utility#setbufvar(buffer, varname, val)
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#getbufvar(buffer, varname, ...)
|
||||
let dict = get(getbufvar(a:buffer, ''), 'gitgutter', {})
|
||||
if has_key(dict, a:varname)
|
||||
return dict[a:varname]
|
||||
else
|
||||
if a:0
|
||||
return a:1
|
||||
let bvars = getbufvar(a:buffer, '')
|
||||
if !empty(bvars)
|
||||
let dict = get(bvars, 'gitgutter', {})
|
||||
if has_key(dict, a:varname)
|
||||
return dict[a:varname]
|
||||
endif
|
||||
endif
|
||||
if a:0
|
||||
return a:1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#warn(message) abort
|
||||
@ -143,9 +145,9 @@ function! gitgutter#utility#set_repo_path(bufnr, continuation) abort
|
||||
" * -2 - not tracked by git
|
||||
|
||||
call gitgutter#utility#setbufvar(a:bufnr, 'path', -1)
|
||||
let cmd = gitgutter#utility#cd_cmd(a:bufnr, g:gitgutter_git_executable.' ls-files --error-unmatch --full-name -z -- '.gitgutter#utility#shellescape(s:filename(a:bufnr)))
|
||||
let cmd = gitgutter#utility#cd_cmd(a:bufnr, g:gitgutter_git_executable.' '.g:gitgutter_git_args.' ls-files --error-unmatch --full-name -z -- '.gitgutter#utility#shellescape(s:filename(a:bufnr)))
|
||||
|
||||
if g:gitgutter_async && gitgutter#async#available()
|
||||
if g:gitgutter_async && gitgutter#async#available() && !has('vim_starting')
|
||||
let handler = copy(s:set_path_handler)
|
||||
let handler.continuation = a:continuation
|
||||
call gitgutter#async#execute(cmd, a:bufnr, handler)
|
||||
|
@ -214,6 +214,9 @@ augroup gitgutter
|
||||
autocmd ShellCmdPost * call gitgutter#all(1)
|
||||
autocmd BufLeave term://* call gitgutter#all(1)
|
||||
|
||||
autocmd BufFilePre * GitGutterBufferDisable
|
||||
autocmd BufFilePost * GitGutterBufferEnable
|
||||
|
||||
" Handle all buffers when focus is gained, but only after it was lost.
|
||||
" FocusGained gets triggered on startup with Neovim at least already.
|
||||
" Therefore this tracks also if it was lost before.
|
||||
|
Reference in New Issue
Block a user