mirror of
https://github.com/neovim/neovim.git
synced 2026-08-30 19:11:52 +00:00
lua: add options to highlight.on_yank (#12549)
NOTE: Configuration options have changed for highlight.on_yank. Check help for |:help highlight.on_yank()|
This commit is contained in:
@@ -711,25 +711,26 @@ VIM.HIGHLIGHT *lua-highlight*
|
||||
Nvim includes a function for highlighting a selection on yank (see for example
|
||||
https://github.com/machakann/vim-highlightedyank). To enable it, add
|
||||
>
|
||||
au TextYankPost * silent! lua require'vim.highlight'.on_yank()
|
||||
au TextYankPost * silent! lua vim.highlight.on_yank()
|
||||
<
|
||||
to your `init.vim`. You can customize the highlight group and the duration of
|
||||
the highlight via
|
||||
>
|
||||
au TextYankPost * silent! lua require'vim.highlight'.on_yank("IncSearch", 500)
|
||||
au TextYankPost * silent! lua vim.highlight.on_yank {higroup="IncSearch", timeout=150}
|
||||
<
|
||||
If you want to exclude visual selections from highlighting on yank, use
|
||||
>
|
||||
au TextYankPost * silent! lua return (not vim.v.event.visual) and require'vim.highlight'.on_yank()
|
||||
au TextYankPost * silent! lua vim.highlight.on_yank {on_visual=false}
|
||||
<
|
||||
|
||||
vim.highlight.on_yank([{higroup}, {timeout}, {event}])
|
||||
*vim.highlight.on_yank()*
|
||||
Highlights the yanked text. Optional arguments are the highlight group
|
||||
to use ({higroup}, default `"IncSearch"`), the duration of highlighting
|
||||
in milliseconds ({timeout}, default `500`), and the event structure
|
||||
that is fired ({event}, default `vim.v.event`).
|
||||
|
||||
vim.highlight.on_yank({opts}) *vim.highlight.on_yank()*
|
||||
Highlights the yanked text. The fields of the optional dict {opts}
|
||||
control the highlight:
|
||||
- {higroup} highlight group for yanked region (default `"IncSearch"`)
|
||||
- {timeout} time in ms before highlight is cleared (default `150`)
|
||||
- {on_macro} highlight when executing macro (default `false`)
|
||||
- {on_visual} highlight when yanking visual selection (default `true`)
|
||||
- {event} event structure (default `vim.v.event`)
|
||||
|
||||
vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {rtype}, {inclusive})
|
||||
*vim.highlight.range()*
|
||||
@@ -739,7 +740,6 @@ vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {rtype}, {inclu
|
||||
or blockwise, see |setreg|; default to characterwise) and whether the
|
||||
range is inclusive (default false).
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
VIM.REGEX *lua-regex*
|
||||
|
||||
|
||||
Reference in New Issue
Block a user