1

I don't really know a better way to describe this, but copying multiple lines in Visual Mode flat out doesn't work. I hit V, highlight the lines, hit y, and then it will tell me "31 lines yanked" (or however many I copied) but then when I go to paste it only puts down the first 2 lines. And one of those lines wasn't even highlighted.

Does anyone have any clue how I can get this text editor to actually do its job? This is some pretty basic stuff and shouldn't be this difficult.

4
  • how are you "pasting?" – Mass Feb 23 '18 at 18:57
  • 'p' is how I'm pasting. – bryanwillis7 Feb 23 '18 at 19:02
  • 1
    it would help to provide an animation + your configuration details. your problem cannot be produced with the level of detail given – Mass Feb 23 '18 at 19:32
  • 2
    check :reg output after pasting. Also check TextYankPost autocommand, and your mappings for y. You could alternatively try to use :norm! gvy – Christian Brabandt Feb 23 '18 at 20:25
2

this is not the expected behavior - perhaps you have something mapped in such a way that it causes this behavior.

try starting vim using vim -u /dev/null -U /dev/null --noplugin

then, assuming the expected behavior, you can divide and conquer in your .vimrc, .gvimrc and plugins.

2
  • 1
    Upvoted because I think this gets to the heart of the problem, but I would note that -U specifies the location of gvimrc, and so isn't necessary or useful in this command, and that NONE is better than /dev/null as it's provided by Vim itself so will work reliably in all operating systems. Using -u NONE also skips loading plugins, so --noplugin is then not required, either. I usually use vim -Nu NONE in order to (un)set nocompatible, too. – Rich Feb 26 '18 at 10:04
  • @rich - you are absolutely correct. primarily, i added these to draw attention to their presence/relevance to the orig question. using NONE is certainly the correct usage with the exception of NONE in -u (lower case) - it has the (unwanted?) side effect of enabling 'compatible', causing other wackiness. it should also be noted that using NORC is the same as NONE except plugins are loaded, hence the inclusion of '--noplugin. from a technical and cleanliness standpoint, tho, your comment is well taken. – wmmso Feb 26 '18 at 18:53
2

I had this issue as well. My problem is that I was using yy to yank the lines instead of just a single y.

Highlighting a block and then hitting yy followed by p where I wanted to paste reproduced this problem (ie only pasted two lines).

Again, the fix is to only use a single y after selecting with V, and then the p should work normally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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