0

I have a rather slow autocmd TextYankPost command that I'm trying to limit to the quoteplus (+) register. I've tried the following to get this to work:

autocmd TextYankPost * if v:event.regname is '+' | ...slow stuff... | endif

However it doesn't work. It looks like most registers that aren't alpha-numeric don't have a regname for this purpose. For example if I do the following:

:autocmd TextYankPost * echomsg v:event.regname

I don't get anything printed to the screen for the +, *, or even " registers. I've discovered this is only a problem on WSL. Running a vim with the exact same vim --version output on a true Linux box does print +, *, or even ".

How can I limit my TextYankPost to only the + register on WSL?

Note: I know I could use another register like u, but + is more intuitive as my command pertains to copying to the GUI.

4
  • What version of Vim are you using? I get the desired result in 9.0.1544 and 9.1.0.
    – romainl
    Mar 26 at 5:39
  • vim 9.0 with patches: 1-749. This does work on my Linux box which has the same version, and on Windows in gVim, but not in WSL. Kind of annoying as my slow command is only needed for WSL. I see the WSL version is "without GUI." I'm guessing that's the problem.
    – Rob Mosher
    Mar 26 at 10:16
  • Nope. Reinstalled vim with gui support, and still the same problem. Also tried -u NONE. Maybe it's a problem specific to vim on WSL. The output of vim --version is identical.
    – Rob Mosher
    Mar 26 at 10:25
  • Filed a bug: github.com/vim/vim/issues/14304
    – Rob Mosher
    Mar 26 at 14:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.