0

I use the same configuration on Windows as I do on Linux. It works normally on Linux but on Windows (vim and gvim) I am getting this odd behavior when putting lines with P:

Steps:

  1. I yank a line with Y in Normal Mode
  2. I go to another line and put it using P. I expect the contents of the " register to be pasted on the current line, with the contents of the current line shifted to the line below. This is what happens on Linux with the same configuration. Instead, the contents of the * register gets pasted on the end of the current line.

If I don't get anyone here telling me that they know what the problem might be I will have to find the problem through the process of elimination.

6
  • 1
    I'm using Vim 9.0 on Windows 10 and P past the line yanked in front of the current line. Sep 14, 2022 at 7:47
  • I yank a line with Y in Normal Mode Y is equivalent of y$, not yy, except for Neovim defaults.
    – Matt
    Sep 14, 2022 at 8:11
  • @Mat I try on bare version of Vim 9.0 or Vim 8.2 and I have Y behaving like yy instead of y$ (set nocompatible is part of _vimrc) Sep 14, 2022 at 9:33
  • 1
    @VivianDeSmedt My bad, the other way round: Y is the same as yy, except if it was mapped to y$ (user config or Neovim defaults, etc.). The OP should try yy anyway, as the words "same config" are often misleading. Y gets remapped quite often.
    – Matt
    Sep 14, 2022 at 9:44
  • 2
    What about :verbose set clipboard? ? More generally, How to debug my vimrc
    – D. Ben Knoble
    Sep 14, 2022 at 14:09

1 Answer 1

0

My configuration is split into different files, so I renamed one at a time to disable them. When I found the file with the problem setting I commented out half of it, found the problem had gone and then through further elimation I found the culprit:

set clipboard+=unnamedplus

:help unnnamedplus
unnamedplus A variant of the "unnamed" flag which uses the clipboard register '+' (quoteplus) instead of register '' for all yank, delete, change and put operations which would normally go to the unnamed register. When "unnamed" is also included to the option, yank operations (but not delete, change or put) will additionally copy the text into register ''. Only available with the +X11 feature. Availability can be checked with: > if has('unnamedplus')

1
  • You might consider citing part of :help clipboard and explaining why this caused the issue you saw
    – D. Ben Knoble
    Sep 15, 2022 at 12:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.