StevieD
StevieD

Reputation: 7433

How do you paste into current line without newline

  1. place cursor in the middle of an existing line of text
  2. go to visual mode with 'v'
  3. hit 'l' several times to highlight some characters
  4. hit 'y' to copy
  5. hit 'esc'
  6. Go to another line of text
  7. Hit 'p' to paste
  8. copied text is pasted after current line instead of into current line

How do I paste the text into the middle of a line of text?

Upvotes: 0

Views: 3037

Answers (1)

Yedhin
Yedhin

Reputation: 3159

The steps you mentioned above should actually paste the yanked characters to the position where the cursor is while pasting. So I believe there are three possible reasons for getting pasted into the newline.

  1. Possibly one of your plugins/mappings is playing the devil here. Just try to use vim without any plugins or anything by running (clean equivalent to "-u DEFAULTS -U NONE -i NONE") and see if it's getting pasted as intended:

    vim --clean

  2. You have yanked the last characters of a line including the newline. Quite possible right? Like the last character of each line is a newline. So yanking and pasting those characters(including newline) to another line means the same newline is pasted into the "another line".

  3. A variant of the above, is when you yank using yy (that is yank the whole line) , then definitely while pasting it would go into a newline.

Hope this helps you somehow. Cheers!

Upvotes: 1

Related Questions