I would like to mimic a nice effect found in the game Vim Adventures: When a yank command is done, I would like the yanked area to be highlighted (let's say in red) for a second to show me that my selection was correct.
For example, yy
would highlight the current line in red one second, then I would know what was selected.
There is a plugin named vim-highlightedyank for this, which works both for Vim and Neovim. Install it and it just works. You can also set the highlight duration by adding the following config:
" set highlight to 1000 ms
let g:highlightedyank_highlight_duration = 1000
If you are using nvim 0.5+, they have made this little feature builtin in this pull request.
No plugin is needed in this case. Just install nvim 0.5+ and add the following config to your init.vim
:
augroup highlight_yank
autocmd!
au TextYankPost * silent! lua vim.highlight.on_yank({higroup="IncSearch", timeout=700})
augroup END
See Neovim's documentation on this feature for more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With