From c2f7a2a18daa7e1d80285818065b2376683dcb21 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Thu, 14 Jul 2022 14:37:00 +0600 Subject: feat: multibuffer preview support for inccommand Allows preview callbacks to modify multiple buffers in order to show the preview. Previously, if multiple buffers were modified, only the current buffer would have its state restored. After this change, all buffers have their state restored after preview. Closes #19103. --- runtime/doc/map.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 00e5cc6e27..2b2bfec6c7 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1466,10 +1466,10 @@ results (for "inccommand=split", or nil for "inccommand=nosplit"). Your command preview routine must implement this protocol: -1. Modify the current buffer as required for the preview (see +1. Modify the target buffers as required for the preview (see |nvim_buf_set_text()| and |nvim_buf_set_lines()|). 2. If preview buffer is provided, add necessary text to the preview buffer. -3. Add required highlights to the current buffer. If preview buffer is +3. Add required highlights to the target buffers. If preview buffer is provided, add required highlights to the preview buffer as well. All highlights must be added to the preview namespace which is provided as an argument to the preview callback (see |nvim_buf_add_highlight()| and @@ -1480,8 +1480,8 @@ Your command preview routine must implement this protocol: 2: Preview is shown and preview window is opened (if "inccommand=split"). For "inccommand=nosplit" this is the same as 1. -After preview ends, Nvim discards all changes to the buffer and all highlights -in the preview namespace. +After preview ends, Nvim discards all changes to all buffers made during the +preview and clears all highlights in the preview namespace. Here's an example of a command to trim trailing whitespace from lines that supports incremental command preview: -- cgit