I'm trying to write a custom yank function but am unable to figure out how to make it non-repeatable (like the normal yank). I have something similar to the following:
function! s:YankMotion(type)
if a:type ==# 'line'
normal! `[V`]y
elseif a:type ==# 'char'
normal! `[v`]y
else
echom "Unexpected selection type"
return
endif
endfunction
nnoremap y :set opfunc=<sid>YankMotion<cr>g@
The problem is that if you do an operation that is repeatable (eg. cw) then yank something, then execute repeat again hitting ., you would expect to trigger cw but instead it tries to do the yank again.
Is it possible to fix this?