Live data from Hacker News

Pasting Text Into Vim

stackoverflow.com

1–10 of 38 posts

Re: Pasting Text Into Vim

#2
"I'd like to paste yanked text into Vim command line."

While the top voted answer is very complete, I prefer editing the command history.

In normal mode, type:

  q:
This will give you a list of recent commands, editable and searchable with normal vim commands. You'll start on a blank command line at the bottom.

For the exact thing that the article asks, pasting a yanked line (or yanked anything) into a command line, yank your text and then:

  q:p
(get into command history edit mode, and then (p)ut your yanked text into a new command line. Edit at will, enter to execute.

To get out of command history mode, it's the opposite. In normal mode in command history, type:

  :q

Re: Pasting Text Into Vim

#3
The title "pasting text into vim" is kind of wrong. This isn't really about pasting text into vim, that is a very easy thing you learn in your first hour of vim (press p or at worst "+p).

It is about the more meta activity of pasting text (e.g. representing a vim command or an argument to a vim command) into the vim command line.

Re: Pasting Text Into Vim

#6
post #2

"I'd like to paste yanked text into Vim command line." While the top voted answer is very complete, I prefer editing the command history. In normal mode, type: q: This will give you a list of recent commands, editable and searchable with normal vim commands. You'll start on a blank command line at the bottom. For the exact thing that the article asks, pasting a yanked line (or yanked anything) into a command line, ya…

Oh this is what that is! I accidentally reach this mode now and then and wonder how I got there and what it does. I must be accidentally pressing q: instead of :q ! This is great and useful. Thanks!

Re: Pasting Text Into Vim

#8
post #6
post #2

"I'd like to paste yanked text into Vim command line." While the top voted answer is very complete, I prefer editing the command history. In normal mode, type: q: This will give you a list of recent commands, editable and searchable with normal vim commands. You'll start on a blank command line at the bottom. For the exact thing that the article asks, pasting a yanked line (or yanked anything) into a command line, ya…

Oh this is what that is! I accidentally reach this mode now and then and wonder how I got there and what it does. I must be accidentally pressing q: instead of :q ! This is great and useful. Thanks!

That's exactly how I found it, by accident. I think a lot of people do.

Re: Pasting Text Into Vim

#10
post #5

tmux buffers Will solve your copy and paste problems across all UNIX applications. Thank you Mr. Marriott. Great software.

doesn't really help with content in vim's registers...

(but you are right, tmux is great)

Post reply on HN