Live data from Hacker News

Pasting Text Into Vim

stackoverflow.com

11–20 of 38 posts

Re: Pasting Text Into Vim

#11

You 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)

Re: Pasting Text Into Vim

#12
post #11

You 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)

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.

Re: Pasting Text Into Vim

#13
post #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)

Don't yank text to vim registers. Copy it to tmux buffers.

1. Ctrl-B [ 2. Ctrl-Space 3. copy desired text 4. Ctrl-w 5. ESC+Shift-: 6. Ctrl-B ] to paste on the vim command line

Re: Pasting Text Into Vim

#14

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.

When I read "pasting text into vim", I thought of still another thing: ":set paste".

Re: Pasting Text Into Vim

#15
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…

> 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

#17
post #9

Not to start an editor war or anything. But a comparable feature set can be found in Emacs[1]. [1]: http://www.gnu.org/software/emacs/manual/html_node/emacs/Reg...

You can also put window configurations into registers. C-x r w r puts your current window configuration (what windows you have open, their sizes and the positions in their buffers) into register r and C-x r j r jumps to that configuration.

I personally find this extremely useful--I use it far more than any other register-based feature. Of course I effectively use Emacs as my window manager for everything except web browsing, ergo I am certifiably insane.

And if ezbl or a similar project ever matures, I might start browsing from Emacs too :P.

Re: Pasting Text Into Vim

#19
post #14

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.

When I read "pasting text into vim", I thought of still another thing: ":set paste".

I thought the same. That one stumped me for a while when I was starting out in vim.

Re: Pasting Text Into Vim

#20
post #12
post #11

Earlier 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.

I use OSX default vim. That might explain things. I'll try

    brew install macvim --override-system-vim
to see if things improve.

EDIT: it works.

Post reply on HN