Compare commits

...

3 Commits

Author SHA1 Message Date
Andy Stewart
6620e5fbbe Document :write in preview window 2025-03-07 09:47:02 +00:00
Andy Stewart
33cb7744c3 Document re-preview moving into Nvim floating window
See #903.
2025-03-07 09:45:42 +00:00
Touko Hallasmaa
d3a9986fe8 Fix moving to floating window 2025-03-07 09:39:31 +00:00
3 changed files with 12 additions and 3 deletions

View File

@@ -533,6 +533,8 @@ let g:gitgutter_async = 0
Add `let g:gitgutter_preview_win_floating = 1` to your `~/.vimrc`. Note that on Vim this prevents you staging (partial) hunks via the preview window.
On Neovim, the preview hunk command will move the cursor into the floating window if it is already open.
#### The appearance of a floating/popup window for hunk previews

View File

@@ -359,6 +359,11 @@ endfunction
function! s:preview(hunk_diff)
if g:gitgutter_preview_win_floating && exists('*nvim_set_current_win') && s:winid != 0
call nvim_set_current_win(s:winid)
return
endif
let lines = split(a:hunk_diff, '\r\?\n')
let header = lines[0:4]
let body = lines[5:]

View File

@@ -201,11 +201,13 @@ Commands for operating on a hunk:~
:GitGutterUndoHunk Undo the hunk the cursor is in.
*gitgutter-:GitGutterPreviewHunk*
:GitGutterPreviewHunk Preview the hunk the cursor is in.
:GitGutterPreviewHunk Preview the hunk the cursor is in or, if you are using
floating preview windows in Neovim and the window is
already open, move the cursor into the window.
To stage part of the hunk, move to the preview window,
delete any lines you do not want to stage, and
|GitGutterStageHunk|.
delete any lines you do not want to stage, and |write|
or |GitGutterStageHunk|.
To close a non-floating preview window use |:pclose|
or |CTRL-W_z| or |CTRL-W_CTRL-Z|; or normal window-