Friday, February 22, 2019

Clipboard triggering CursorHold?

Are there documented cases in Vim 7 of CursorHold being triggered by the clipboard's usage? I'm running into this scenario:

1. Set CursorHold to do something
2. Set a clipboard value from within Vim (set @+ = "X")
3. Paste anywhere outside of Vim
4. CursorHold is (randomly) executed

A few notes:
* Running Ubuntu 16.04 + Gnome, Vim 7.4. Problem isn't triggered in Vim 8.1.
* It may take a few 'pastes' outside of Vim before CursorHold is triggered (may be one, may be fifty)
* In all cases, CursorHold is triggered before its timeout (I'm using 500 seconds)
* Always happens exactly when pasting (ie as far as I've noticed, it's not randomly triggered by other events)
* CursorHold is not triggered if the contents of the clipboard are not set within Vim (ie: set the contents of the clipboard within Vim, copy something else from outside Vim, the CursorHold isn't triggered until its timeout)

I'm using the script copied below to test this out (run with vim -u ./script.vim) - after Vim started, I :call XX() and paste anywhere outside Vim - usually after 1 or 2 tries I get a "Ping".

Any ideas what may be triggering CursorHold and how to avoid it?


function! XX()
let @+ = "XX"
endfunction

set updatetime=500000
autocmd CursorHold * echo "Ping"

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: