1
0
mirror of https://github.com/amix/vimrc synced 2025-07-10 03:25:00 +08:00
This commit is contained in:
geezus
2021-06-30 12:00:07 -05:00
parent 43c7efba8d
commit 3afe70fe5a
1529 changed files with 3053 additions and 3018 deletions

34
sources_non_forked/vim-gitgutter/autoload/gitgutter.vim Normal file → Executable file
View File

@ -23,11 +23,6 @@ function! gitgutter#process_buffer(bufnr, force) abort
if gitgutter#utility#is_active(a:bufnr)
<<<<<<< HEAD
call s:setup_maps(a:bufnr)
=======
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
if has('patch-7.4.1559')
let l:Callback = function('gitgutter#process_buffer', [a:bufnr, a:force])
else
@ -109,23 +104,11 @@ endfunction
" }}}
<<<<<<< HEAD
function! s:setup_maps(bufnr)
=======
function! gitgutter#setup_maps()
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
if !g:gitgutter_map_keys
return
endif
<<<<<<< HEAD
if gitgutter#utility#getbufvar(a:bufnr, 'mapped', 0)
return
endif
if !hasmapto('<Plug>GitGutterPrevHunk') && maparg('[c', 'n') ==# ''
nmap <buffer> [c <Plug>GitGutterPrevHunk
=======
" Note hasmapto() and maparg() operate on the current buffer.
let bufnr = bufnr('')
@ -136,7 +119,6 @@ function! gitgutter#setup_maps()
if !hasmapto('<Plug>(GitGutterPrevHunk)') && maparg('[c', 'n') ==# ''
nmap <buffer> [c <Plug>(GitGutterPrevHunk)
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
endif
if !hasmapto('<Plug>(GitGutterNextHunk)') && maparg(']c', 'n') ==# ''
nmap <buffer> ]c <Plug>(GitGutterNextHunk)
@ -174,19 +156,6 @@ endfunction
function! s:setup_path(bufnr, continuation)
if gitgutter#utility#has_repo_path(a:bufnr) | return | endif
<<<<<<< HEAD
call gitgutter#utility#setbufvar(a:bufnr, 'mapped', 1)
endfunction
function! s:setup_path(bufnr, continuation)
let p = gitgutter#utility#repo_path(a:bufnr, 0)
if type(p) == s:t_string && !empty(p) " if path is known
return
endif
=======
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
return gitgutter#utility#set_repo_path(a:bufnr, a:continuation)
endfunction
@ -203,8 +172,6 @@ function! s:clear(bufnr)
call gitgutter#hunk#reset(a:bufnr)
call s:reset_tick(a:bufnr)
call gitgutter#utility#setbufvar(a:bufnr, 'path', '')
<<<<<<< HEAD
=======
endfunction
@ -247,5 +214,4 @@ function! gitgutter#quickfix()
else
call setloclist(0, locations)
endif
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
endfunction

View File

View File

View File

@ -6,11 +6,7 @@ let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
" True for git v1.7.2+.
function! s:git_supports_command_line_config_override() abort
<<<<<<< HEAD
call system(g:gitgutter_git_executable.' '.g:gitgutter_git_args.' -c foo.bar=baz --version')
=======
call gitgutter#utility#system(g:gitgutter_git_executable.' '.g:gitgutter_git_args.' -c foo.bar=baz --version')
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
return !v:shell_error
endfunction

View File

View File

View File

@ -184,8 +184,6 @@ function! s:define_sign_line_highlights() abort
endif
endfunction
<<<<<<< HEAD
=======
function! s:define_sign_linenr_highlights() abort
if has('nvim-0.3.2')
try
@ -209,7 +207,6 @@ function! s:define_sign_linenr_highlights() abort
endif
endfunction
>>>>>>> 27ad0d07862847896f691309a544a206783c94d6
function! s:get_hl(group, what, mode) abort
let r = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode)
if empty(r) || r == -1

View File

@ -257,6 +257,7 @@ function! s:hunk_op(op, ...)
let g:gitgutter_async = async
call gitgutter#hunk#set_hunks(bufnr, gitgutter#diff#parse_diff(diff))
call gitgutter#diff#process_hunks(bufnr, gitgutter#hunk#hunks(bufnr)) " so the hunk summary is updated
if empty(s:current_hunk())
call gitgutter#utility#warn('cursor is not in a hunk')
@ -440,16 +441,24 @@ function! s:open_hunk_preview_window()
" Assumes cursor is in original window.
autocmd CursorMoved <buffer> ++once call s:close_hunk_preview_window()
if g:gitgutter_close_preview_on_escape
nnoremap <buffer> <silent> <Esc> :call <SID>close_hunk_preview_window()<CR>
endif
return
endif
if exists('*popup_create')
let s:winid = popup_create('', {
let opts = {
\ 'line': 'cursor+1',
\ 'col': 'cursor',
\ 'moved': 'any',
\ })
\ }
if g:gitgutter_close_preview_on_escape
let opts.filter = function('s:close_popup_on_escape')
endif
let s:winid = popup_create('', opts)
call setbufvar(winbufnr(s:winid), '&filetype', 'diff')
@ -461,7 +470,8 @@ function! s:open_hunk_preview_window()
if &previewwindow
file gitgutter://hunk-preview
else
noautocmd execute g:gitgutter_preview_win_location &previewheight 'new gitgutter://hunk-preview'
noautocmd execute g:gitgutter_preview_win_location &previewheight 'new'
file gitgutter://hunk-preview
doautocmd WinEnter
set previewwindow
endif
@ -479,6 +489,15 @@ function! s:open_hunk_preview_window()
endfunction
function! s:close_popup_on_escape(winid, key)
if a:key == "\<Esc>"
call popup_close(a:winid)
return 1
endif
return 0
endfunction
" Floating window: does not care where cursor is.
" Preview window: assumes cursor is in preview window.
function! s:populate_hunk_preview_window(header, body)

View File

View File

@ -176,15 +176,20 @@ endfunction
function! s:use_known_shell() abort
if has('unix') && &shell !=# 'sh'
let [s:shell, s:shellcmdflag, s:shellredir] = [&shell, &shellcmdflag, &shellredir]
let [s:shell, s:shellcmdflag, s:shellredir, s:shellpipe, s:shellquote, s:shellxquote] = [&shell, &shellcmdflag, &shellredir, &shellpipe, &shellquote, &shellxquote]
let &shell = 'sh'
set shellcmdflag=-c shellredir=>%s\ 2>&1
endif
if has('win32') && (&shell =~# 'pwsh' || &shell =~# 'powershell')
let [s:shell, s:shellcmdflag, s:shellredir, s:shellpipe, s:shellquote, s:shellxquote] = [&shell, &shellcmdflag, &shellredir, &shellpipe, &shellquote, &shellxquote]
let &shell = 'cmd.exe'
set shellcmdflag=/s\ /c shellredir=>%s\ 2>&1 shellpipe=>%s\ 2>&1 shellquote= shellxquote="
endif
endfunction
function! s:restore_shell() abort
if has('unix') && exists('s:shell')
let [&shell, &shellcmdflag, &shellredir] = [s:shell, s:shellcmdflag, s:shellredir]
if (has('unix') || has('win32')) && exists('s:shell')
let [&shell, &shellcmdflag, &shellredir, &shellpipe, &shellquote, &shellxquote] = [s:shell, s:shellcmdflag, s:shellredir, s:shellpipe, s:shellquote, s:shellxquote]
endif
endfunction