"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!
Pasting Text Into Vim
21–30 of 38 posts
Re: Pasting Text Into Vim
#22"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…
> To get out of command history mode, it's the opposite. You can leave command history just by typing , not :q .
Re: Pasting Text Into Vim
#23tmux buffers Will solve your copy and paste problems across all UNIX applications. Thank you Mr. Marriott. Great software.
Re: Pasting Text Into Vim
#24Sorry I am a massive vim junkie, but why is this getting so much love ?
Re: Pasting Text Into Vim
#25You can also yank from Vim to the system clipboard with "+y Took me a year or so to learn that one
:help clipboard
Also another AWESOME tip , if you set an "a" among your guioptions, your visual selects and mouse selects automatically get copied to the * register. : help quotestar
I realize that X environments mainly do this already, but not the visual select. Most of my editing is through SSH so I don't get to use the gui features much. The only time I use gvim is in windows, so it was pretty revolutionary for me.Re: Pasting Text Into Vim
#26The 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.
When I read "pasting text into vim", I thought of still another thing: ":set paste".
Life is suddenly easier :)
Re: Pasting Text Into Vim
#27"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…
:%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 frequently end up doing is entering paste mode (:set paste) and just using my terminal emulator's paste buffer.. you can also sync these using tmux's buffers etc if you want, but it's a little less elegant imo..
once you have set/unset paste mode aliased to something sensible it makes the whole process as simple as it gets imo
for your vimrc
nmap p :set invpaste:set paste?
Re: Pasting Text Into Vim
#28Earlier quoted context omitted.
When I read "pasting text into vim", I thought of still another thing: ":set paste".
My .vimrc contains: set pastetoggle= Life is suddenly easier :)
set pastetoggle=[201~
noremap [200~ :set paste0i
inoremap [200~ :set paste
cnoremap [200~
cnoremap [201~
let &t_ti="\[?2004h"
let &t_te="\[?2004l"
the ti/te sequences are passed from Vim to the client which tells Putty (and others) to bracket all pasting with \e[200~ and \e[201~. The other commands handle these sequences to make pasting happen transparently without having to hit F2 ;o)
Re: Pasting Text Into Vim
#29Sorry I am a massive vim junkie, but why is this getting so much love ?
Re: Pasting Text Into Vim
#30Earlier quoted context omitted.
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)
It can work in terminal vim, too. I believe the special + register for the system clipboard is enabled by a compile option, but that may not be entirely accurate. I have Vim 7.3 installed via Macports and it works for me.
[MacVim]: http://code.google.com/p/macvim/