aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/map.txt
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2025-02-05 23:09:29 +0000
committerJosh Rahm <joshuarahm@gmail.com>2025-02-05 23:09:29 +0000
commitd5f194ce780c95821a855aca3c19426576d28ae0 (patch)
treed45f461b19f9118ad2bb1f440a7a08973ad18832 /runtime/doc/map.txt
parentc5d770d311841ea5230426cc4c868e8db27300a8 (diff)
parent44740e561fc93afe3ebecfd3618bda2d2abeafb0 (diff)
downloadrneovim-rahm.tar.gz
rneovim-rahm.tar.bz2
rneovim-rahm.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309HEADrahm
Diffstat (limited to 'runtime/doc/map.txt')
-rw-r--r--runtime/doc/map.txt18
1 files changed, 8 insertions, 10 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 11048aee30..52c04333fc 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -12,7 +12,7 @@ manual.
Type |gO| to see the table of contents.
==============================================================================
-1. Key mapping *key-mapping* *mapping* *macro*
+1. Key mapping *keybind* *key-mapping* *mapping*
Key mapping is used to change the meaning of typed keys. The most common use
is to define a sequence of commands for a function key. Example: >
@@ -1545,7 +1545,7 @@ Your command preview routine must implement this protocol:
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
+ argument to the preview callback (see |vim.hl.range()| and
|nvim_buf_set_extmark()| for help on how to add highlights to a namespace).
4. Return an integer (0, 1, 2) which controls how Nvim behaves as follows:
0: No preview is shown.
@@ -1574,13 +1574,12 @@ supports incremental command preview:
if start_idx then
-- Highlight the match
- vim.api.nvim_buf_add_highlight(
+ vim.hl.range(
buf,
preview_ns,
'Substitute',
- line1 + i - 2,
- start_idx - 1,
- end_idx
+ {line1 + i - 2, start_idx - 1},
+ {line1 + i - 2, end_idx},
)
-- Add lines and set highlights in the preview buffer
@@ -1595,13 +1594,12 @@ supports incremental command preview:
false,
{ prefix .. line }
)
- vim.api.nvim_buf_add_highlight(
+ vim.hl.range(
preview_buf,
preview_ns,
'Substitute',
- preview_buf_line,
- #prefix + start_idx - 1,
- #prefix + end_idx
+ {preview_buf_line, #prefix + start_idx - 1},
+ {preview_buf_line, #prefix + end_idx},
)
preview_buf_line = preview_buf_line + 1
end