-*usr_05.txt* For Vim version 9.2. Last change: 2026 Feb 14
+*usr_05.txt* For Vim version 9.2. Last change: 2026 May 11
VIM USER MANUAL by Bram Moolenaar
To disable the effect of the plugin after it has been loaded: >
au! hlyank
+Additionally, the plugin can also highlight regions that are put using the
+|TextPutPost| autocommand. This is by default disabled and can be enabled
+using: >
+ :let g:hlput_enable = v:true
+<
+The following configuration variables can be used are "g:hlput_hlgroup" and
+"g:hlput_duration", which have the same effect as their yank counterparts: >
+ :let g:hlput_hlgroup = 'IncSearch'
+ :let g:hlput_duration = 300
+
------------------------------------------------------------------------------
Adding the osc52 package *osc52-install* *package-osc52*
------------------------------------------------------------------------------
-*version9.txt* For Vim version 9.2. Last change: 2026 May 10
+*version9.txt* For Vim version 9.2. Last change: 2026 May 11
VIM REFERENCE MANUAL by Bram Moolenaar
- |:command-completion-customlist| can return a list of dictionaries with
kind/menu/info/abbr for the popup menu.
- |C-indenting| detects comments better.
+- The |package-hlyank| can now optionally highlight the last put region as
+ well.
Platform specific ~
-----------------
vim9script
# Highlight Yank plugin
-# Last Change: 2026 Apr 11
+# Last Change: 2026 May 11
def HighlightedYank()
endif
enddef
+export def HighlightedPut()
+ if !get(g:, "hlput_enable", false)
+ return
+ endif
+
+ var hlgroup = get(g:, "hlput_hlgroup", "IncSearch")
+ var duration = min([get(g:, "hlput_duration", 300), 3000])
+
+ var [beg, end] = [getpos("'["), getpos("']")]
+ var type = v:event.regtype ?? 'v'
+ var pos = getregionpos(beg, end, {type: type, exclusive: false})
+
+ var m = matchaddpos(hlgroup, pos->mapnew((_, v) => {
+ var col_beg = v[0][2] + v[0][3]
+ var col_end = v[1][2] + v[1][3] + 1
+ return [v[0][1], col_beg, col_end - col_beg]
+ }))
+ var winid = win_getid()
+ timer_start(duration, (_) => {
+ if winbufnr(winid) != -1
+ m->matchdelete(winid)
+ endif
+ })
+enddef
+
augroup hlyank
autocmd!
autocmd TextYankPost * HighlightedYank()
+ autocmd TextPutPost * HighlightedPut()
augroup END
# vim:sts=2:sw=2:et: