1
- *usr_52.txt* For Vim version 9.1. Last change: 2024 May 31
1
+ *usr_52.txt* For Vim version 9.1. Last change: 2024 Jun 09
2
2
3
3
VIM USER MANUAL - by Bram Moolenaar
4
4
@@ -341,7 +341,7 @@ will have to make sure to use a unique name for these global items. Example: >
341
341
342
342
COMMENT PACKAGE
343
343
344
- Vim comes with a comment plugin, written in Vim9 script | comment-install | .
344
+ Vim comes with a comment plugin, written in Vim9 script. | comment-install |
345
345
Have a look at the package located at $VIMRUNTIME/pack/dist/opt/comment/
346
346
347
347
HIGHLIGHT YANK PLUGIN
@@ -350,27 +350,27 @@ Here is an example for highlighting the yanked region. It makes use of the
350
350
| getregionpos() | function, available since Vim 9.1.0446.
351
351
352
352
Copy the following example into a new file and place it into your plugin directory
353
- and it will be active next time you start Vim | add-plugin | : >
353
+ and it will be active next time you start Vim. | add-plugin | : >
354
354
355
355
vim9script
356
356
357
357
def HighlightedYank(hlgroup = 'IncSearch', duration = 300, in_visual = true)
358
358
if v:event.operator ==? 'y'
359
- if !in_visual && visualmode() != null_string
360
- visualmode(1)
361
- return
362
- endif
363
- var [beg, end] = [getpos("'["), getpos("']")]
364
- var type = v:event.regtype ?? 'v'
365
- var pos = getregionpos(beg, end, {type: type})
366
- var end_offset = (type == 'V' || v:event.inclusive) ? 1 : 0
367
- var m = matchaddpos(hlgroup, pos->mapnew((_, v) => {
368
- var col_beg = v[0][2] + v[0][3]
369
- var col_end = v[1][2] + v[1][3] + end_offset
370
- return [v[0][1], col_beg, col_end - col_beg]
371
- }))
372
- var winid = win_getid()
373
- timer_start(duration, (_) => m->matchdelete(winid))
359
+ if !in_visual && visualmode() != null_string
360
+ visualmode(1)
361
+ return
362
+ endif
363
+ var [beg, end] = [getpos("'["), getpos("']")]
364
+ var type = v:event.regtype ?? 'v'
365
+ var pos = getregionpos(beg, end, {type: type})
366
+ var end_offset = (type == 'V' || v:event.inclusive) ? 1 : 0
367
+ var m = matchaddpos(hlgroup, pos->mapnew((_, v) => {
368
+ var col_beg = v[0][2] + v[0][3]
369
+ var col_end = v[1][2] + v[1][3] + end_offset
370
+ return [v[0][1], col_beg, col_end - col_beg]
371
+ }))
372
+ var winid = win_getid()
373
+ timer_start(duration, (_) => m->matchdelete(winid))
374
374
endif
375
375
enddef
376
376
0 commit comments