aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/map.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/map.txt')
-rw-r--r--runtime/doc/map.txt11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index b0ce2d4164..2b2bfec6c7 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1452,6 +1452,9 @@ Incremental preview ~
Commands can show an 'inccommand' (as-you-type) preview by defining a preview
handler (only from Lua, see |nvim_create_user_command()|).
+Before the preview callback is executed, Nvim will temporarily disable
+'cursorline' and 'cursorcolumn' to avoid highlighting issues.
+
The preview callback must be a Lua function with this signature: >
function cmdpreview(opts, ns, buf)
@@ -1463,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
@@ -1477,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: