mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-11 13:03:45 -05:00
Avoid cursor in unexpected window after Esc in preview
Thanks @andymass for the patch. See #769.
This commit is contained in:
@@ -466,6 +466,8 @@ function! s:open_hunk_preview_window()
|
|||||||
endif
|
endif
|
||||||
endif
|
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).
|
||||||
noautocmd execute g:gitgutter_preview_win_location 'pedit gitgutter://hunk-preview'
|
noautocmd execute g:gitgutter_preview_win_location 'pedit gitgutter://hunk-preview'
|
||||||
silent! wincmd P
|
silent! wincmd P
|
||||||
setlocal statusline=%{''}
|
setlocal statusline=%{''}
|
||||||
@@ -479,7 +481,8 @@ function! s:open_hunk_preview_window()
|
|||||||
" Reset some defaults in case someone else has changed them.
|
" Reset some defaults in case someone else has changed them.
|
||||||
setlocal noreadonly modifiable noswapfile
|
setlocal noreadonly modifiable noswapfile
|
||||||
if g:gitgutter_close_preview_on_escape
|
if g:gitgutter_close_preview_on_escape
|
||||||
nnoremap <buffer> <silent> <Esc> :pclose<CR>
|
" Ensure cursor goes to the expected window.
|
||||||
|
nnoremap <buffer> <silent> <Esc> :<C-U>wincmd p<Bar>pclose<CR>
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user