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

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