runtime(hlyank): update the hlyank package

closes: #16944

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Hirohito Higashi
2025-03-22 15:58:59 +01:00
committed by Christian Brabandt
parent 19d4f99a34
commit e14aa3c035
2 changed files with 11 additions and 8 deletions

View File

@ -1,4 +1,4 @@
*usr_05.txt* For Vim version 9.1. Last change: 2025 Mar 18 *usr_05.txt* For Vim version 9.1. Last change: 2025 Mar 22
VIM USER MANUAL - by Bram Moolenaar VIM USER MANUAL - by Bram Moolenaar
@ -470,8 +470,8 @@ Load the plugin with this command: >
packadd hlyank packadd hlyank
< <
This package briefly highlights the affected region of the last |yank| This package briefly highlights the affected region of the last |yank|
command. See |52.6| for a simplified implementation using the |getregionpos()| command. See |52.6| for a simplified implementation using the
function. |getregionpos()| function.
The plugin understands the following configuration variables (the settings The plugin understands the following configuration variables (the settings
show the default values). show the default values).
@ -481,7 +481,9 @@ To specify a different highlighting group, use: >
< <
To use a different highlighting duration, use: > To use a different highlighting duration, use: >
:let g:hlyank_duration = 300 :let g:hlyank_duration = 300
< The unit is milliseconds, and the upper limit is 3000 ms. If you set a value
higher than this, the highlighting duration will be 3000 ms.
To highlight in visual mode, use: > To highlight in visual mode, use: >
:let g:hlyank_invisual = v:true :let g:hlyank_invisual = v:true

View File

@ -1,12 +1,12 @@
vim9script vim9script
# Highlight Yank plugin # Highlight Yank plugin
# Last Change: 2025 Mar 17 # Last Change: 2025 Mar 22
def HighlightedYank() def HighlightedYank()
var hlgroup = get(g:, "hlyank_hlgroup", "IncSearch") var hlgroup = get(g:, "hlyank_hlgroup", "IncSearch")
var duration = get(g:, "hlyank_duration", 300) var duration = min([get(g:, "hlyank_duration", 300), 3000])
var in_visual = get(g:, "hlyank_invisual", true) var in_visual = get(g:, "hlyank_invisual", true)
if v:event.operator ==? 'y' if v:event.operator ==? 'y'
@ -14,8 +14,8 @@ def HighlightedYank()
visualmode(1) visualmode(1)
return return
endif endif
# if clipboard has autoselect (default on linux) exiting from Visual with ESC # if clipboard has autoselect (default on linux) exiting from Visual with
# generates bogus event and this highlights previous yank # ESC generates bogus event and this highlights previous yank
if &clipboard =~ 'autoselect' && v:event.regname == "*" && v:event.visual if &clipboard =~ 'autoselect' && v:event.regname == "*" && v:event.visual
return return
endif endif
@ -36,3 +36,4 @@ augroup hlyank
autocmd! autocmd!
autocmd TextYankPost * HighlightedYank() autocmd TextYankPost * HighlightedYank()
augroup END augroup END
# vim:sts=2:sw=2:et: