Reputation: 2081
Is there a way to have vim always call a defined function after any yanking operation? Doing something like nnoremap y y:function<CR>
results in abnormal behavior.
Upvotes: 1
Views: 1091
Reputation: 45117
The TextYankPost
event will be triggered after text has been yanked or deleted. See :h TextYankPost
for more help.
augroup Example
autocmd!
autocmd TextYankPost * if v:event.operator ==# 'y' | call somefunction() | endif
augroup END
I know that vim-highlightedyank uses the TextYankPost
event and maybe a place to look for inspiration.
Upvotes: 5