diff --git a/autoload/gitgutter/hunk.vim b/autoload/gitgutter/hunk.vim index f80e93a..2c9aa05 100644 --- a/autoload/gitgutter/hunk.vim +++ b/autoload/gitgutter/hunk.vim @@ -455,6 +455,9 @@ function! s:open_hunk_preview_window() setlocal filetype=diff buftype=acwrite bufhidden=delete " Reset some defaults in case someone else has changed them. setlocal noreadonly modifiable noswapfile + if g:gitgutter_close_preview_on_escape + nnoremap :pclose + endif endfunction diff --git a/doc/gitgutter.txt b/doc/gitgutter.txt index 2d744a8..c3d1ac6 100644 --- a/doc/gitgutter.txt +++ b/doc/gitgutter.txt @@ -311,6 +311,7 @@ Signs:~ Hunk previews:~ |g:gitgutter_preview_win_floating| + |g:gitgutter_close_preview_on_escape| Terminal:~ @@ -468,6 +469,11 @@ Whether to use floating/popup windows for hunk previews. Note that if you use popup windows on Vim you will not be able to stage partial hunks via the preview window. + *g:gitgutter_close_preview_on_escape* +Default: 0 + +Whether pressing in a non-floating preview window closes it. + *g:gitgutter_terminal_reports_focus* Default: 1 diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index 1b62403..70b0198 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -73,6 +73,7 @@ call s:set('g:gitgutter_terminal_reports_focus', 1) call s:set('g:gitgutter_async', 1) call s:set('g:gitgutter_log', 0) call s:set('g:gitgutter_use_location_list', 0) +call s:set('g:gitgutter_close_preview_on_escape', 0) call s:set('g:gitgutter_git_executable', 'git') if !executable(g:gitgutter_git_executable)