justinmk / vim-sneak

The missing motion for Vim :athletic_shoe:
http://www.vim.org/scripts/script.php?script_id=4809
MIT License
3.26k stars 88 forks source link

Can't repeat a yank after using the "z" text-object #255

Closed lacygoill closed 4 years ago

lacygoill commented 4 years ago

Describe the bug

A yank can't be repeated after using the z text-object, even if 'cpo' contains the y flag.

To Reproduce

Run this shell command (you'll need to update the paths to the plugins):

vim -i NONE -Nu <(cat <<'EOF'
    set rtp^=/path/to/vim-sneak
    set rtp^=/path/to/vim-repeat
    set cpo+=y
    au VimEnter * %d | pu!='abcd' | .t. | update | omap z <plug>Sneak_s
EOF
) /tmp/file

A new pair of characters is asked.

Expected behavior

The last pair of characters is automatically re-used.

Screenshots

gif

Environment

Additional context

I tried to fix the issue by replacing this line: https://github.com/justinmk/vim-sneak/blob/98a5c946d6dc76528b9d9b044059b5ef1fab5a48/plugin/sneak.vim#L240

With:

if is_op && (a:op !=# 'y' || &cpo =~# 'y')

But it doesn't work.

lacygoill commented 4 years ago

I don't think this issue can be fixed because a yank doesn't increase b:changedtick, and vim-repeat doesn't handle well such an operator (the user may need to invoke repeat#invalidate(), but in practice it's not always possible) . I just thought it was worth being reported.

justinmk commented 4 years ago

Yank is not traditionally dot-repeatable in Vim, also.

I see that you also found https://github.com/tpope/vim-repeat/issues/63 ...