"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…
Pasting Text Into Vim
31–38 of 38 posts
Re: Pasting Text Into Vim
#32Re: Pasting Text Into Vim
#33Re: Pasting Text Into Vim
#34You can also yank from Vim to the system clipboard with "+y Took me a year or so to learn that one
Of course it only works for non-terminal vim. Someone may make it work on Mac though by leveraging pb{copy,paste} in some clever way (can't remember the X11 equivalent ATM)
pbcopy = xsel -bi
pbpaste = xsel -bRe: Pasting Text Into Vim
#35"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!
q/ - Search string history
q: - Ex cmdline history
q? - Search string history
Also note that if you normally use Ctrl-C to exit Insert mode, that fails here as Ctrl-C will close the history buffer. You need to use Escape or Ctrl-[.Re: Pasting Text Into Vim
#36"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…
another way to get into this mode is to start doing a complex command.. so :%s/ and when you realise it's not as simple as you first thought.. doing ^f will take you "command line" buffer where you can do all the normal vim commands.. as for copy/paste .. if your vim is compiled with the option "+clipboard" then you can use the "+" register to interact with all your system copy/pasting.. however, what I most frequent…
Do you have any idea how many tutorials there are out there that involve some kind of obscure plugin or xclip incantation for something as simple as pasting text over ssh with formatting?
To think all I needed to do was :set paste... Extraordinary.
Re: Pasting Text Into Vim
#37 C-r-w
Handy for renaming variables with :%s/oldname/newname/g, for example.Re: Pasting Text Into Vim
#38You can also yank from Vim to the system clipboard with "+y Took me a year or so to learn that one
Or, you can add this to your vimrc to always yank to system clipboard: set clipboard+=unnamed
I've been using the "+ register intensively. Your tip will save me from quite a lot of keystrokes in the future.