mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -382,12 +382,6 @@ function! s:fix_file_references(filepath, hunk_diff)
|
||||
return join(lines, "\n")."\n"
|
||||
endfunction
|
||||
|
||||
if $VIM_GITGUTTER_TEST
|
||||
function! gitgutter#hunk#fix_file_references(filepath, hunk_diff)
|
||||
return s:fix_file_references(a:filepath, a:hunk_diff)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
function! s:adjust_hunk_summary(hunk_diff) abort
|
||||
let line_adjustment = s:line_adjustment_for_current_hunk()
|
||||
@ -431,14 +425,7 @@ function! s:open_hunk_preview_window()
|
||||
|
||||
let buf = nvim_create_buf(v:false, v:false)
|
||||
" Set default width and height for now.
|
||||
let s:winid = nvim_open_win(buf, v:false, {
|
||||
\ 'relative': 'cursor',
|
||||
\ 'row': 1,
|
||||
\ 'col': 0,
|
||||
\ 'width': 42,
|
||||
\ 'height': &previewheight,
|
||||
\ 'style': 'minimal'
|
||||
\ })
|
||||
let s:winid = nvim_open_win(buf, v:false, g:gitgutter_floating_window_options)
|
||||
call nvim_buf_set_option(buf, 'filetype', 'diff')
|
||||
call nvim_buf_set_option(buf, 'buftype', 'acwrite')
|
||||
call nvim_buf_set_option(buf, 'bufhidden', 'delete')
|
||||
@ -461,16 +448,11 @@ function! s:open_hunk_preview_window()
|
||||
endif
|
||||
|
||||
if exists('*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')
|
||||
let g:gitgutter_floating_window_options.filter = function('s:close_popup_on_escape')
|
||||
endif
|
||||
|
||||
let s:winid = popup_create('', opts)
|
||||
let s:winid = popup_create('', g:gitgutter_floating_window_options)
|
||||
|
||||
call setbufvar(winbufnr(s:winid), '&filetype', 'diff')
|
||||
|
||||
@ -478,6 +460,10 @@ function! s:open_hunk_preview_window()
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('&previewpopup')
|
||||
let [previewpopup, &previewpopup] = [&previewpopup, '']
|
||||
endif
|
||||
|
||||
" Specifying where to open the preview window can lead to the cursor going
|
||||
" to an unexpected window when the preview window is closed (#769).
|
||||
silent! noautocmd execute g:gitgutter_preview_win_location 'pedit gitgutter://hunk-preview'
|
||||
@ -496,6 +482,10 @@ function! s:open_hunk_preview_window()
|
||||
" Ensure cursor goes to the expected window.
|
||||
nnoremap <buffer> <silent> <Esc> :<C-U>wincmd p<Bar>pclose<CR>
|
||||
endif
|
||||
|
||||
if exists('&previewpopup')
|
||||
let &previewpopup=previewpopup
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@ -515,7 +505,7 @@ function! s:populate_hunk_preview_window(header, body)
|
||||
|
||||
if g:gitgutter_preview_win_floating
|
||||
if exists('*nvim_open_win')
|
||||
let height = min([body_length, &previewheight])
|
||||
let height = min([body_length, g:gitgutter_floating_window_options.height])
|
||||
|
||||
" Assumes cursor is not in previewing window.
|
||||
call nvim_buf_set_var(winbufnr(s:winid), 'hunk_header', a:header)
|
||||
|
Reference in New Issue
Block a user