1
0
mirror of https://github.com/amix/vimrc synced 2025-06-30 11:54:59 +08:00

Updated plugins

This commit is contained in:
Amir
2023-08-20 16:33:32 +02:00
parent 06f872cb2f
commit 8240935caa
34 changed files with 497 additions and 279 deletions

View File

@ -248,7 +248,9 @@ function! s:hunk_op(op, ...)
let hunk_diff = join(hunk_header + hunk_body, "\n")."\n"
call s:goto_original_window()
if &previewwindow
call s:goto_original_window()
endif
call gitgutter#hunk#close_hunk_preview_window()
call s:stage(hunk_diff)
endif
@ -460,18 +462,16 @@ function! s:open_hunk_preview_window()
call nvim_buf_set_option(buf, 'swapfile', v:false)
call nvim_buf_set_name(buf, 'gitgutter://hunk-preview')
if g:gitgutter_close_preview_on_escape
let winnr = nvim_win_get_number(s:winid)
execute winnr.'wincmd w'
nnoremap <buffer> <silent> <Esc> :<C-U>call gitgutter#hunk#close_hunk_preview_window()<CR>
wincmd w
endif
" Assumes cursor is in original window.
autocmd CursorMoved,TabLeave <buffer> ++once call gitgutter#hunk#close_hunk_preview_window()
if g:gitgutter_close_preview_on_escape
" Map <Esc> to close the floating preview.
nnoremap <buffer> <silent> <Esc> :<C-U>call gitgutter#hunk#close_hunk_preview_window()<CR>
" Ensure that when the preview window is closed, the map is removed.
autocmd User GitGutterPreviewClosed silent! nunmap <buffer> <Esc>
autocmd CursorMoved <buffer> ++once silent! nunmap <buffer> <Esc>
execute "autocmd WinClosed <buffer=".winbufnr(s:winid)."> doautocmd" s:nomodeline "User GitGutterPreviewClosed"
endif
return
endif

View File

@ -19,7 +19,8 @@ function! gitgutter#utility#setbufvar(buffer, varname, val)
endfunction
function! gitgutter#utility#getbufvar(buffer, varname, ...)
let ggvars = getbufvar(a:buffer, 'gitgutter')
let buffer = +a:buffer
let ggvars = getbufvar(buffer, 'gitgutter')
if type(ggvars) == type({}) && has_key(ggvars, a:varname)
return ggvars[a:varname]
endif