Hi community,
I use this to highlight occurrences of the word when cursor is inside
the word, and cancel the highlight when cursor is outside.
```
autocmd CursorMoved,CursorMovedI * execute 'match Visual' (getline('.')[col('.')-1] =~# '\w' ? '/\<' . escape(expand('<cword>'), '/\.*$^~[]') . '\>/' : '//')
```
When i `:help autocmd` and read lines like these:
` autocmd_add({replace: `
` autocmd_add(#{replace: `
(backticks are not part of them)
if I place cursor on ` autocmd_add ` or ` replace `,
this whole string ` autocmd_add({replace: ` is highlighted as a whole
wrongly, and this is wrong too ` autocmd_add(#{replace: `.
But when I open the file directly with vim:
` $ vi /usr/share/vim/vim90/doc/autocmd.txt `
` autocmd_add ` and ` replace ` are not highlighted together as a whole.
it seems that the pattern does not count ` ( `, ` # `, ` { ` as boundary
of words in ` :help ` buffer. how can I fix it?
Thanks!</cword>
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/tencent_3174790CB14343CFF9B4C1411891C65F9308%40qq.com.
Sunday, March 3, 2024
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment