tags:

views:

865

answers:

5

I am trying to copy a selection of text from vim to another windows application...say firefox or notepad for example. However I cant seem to do this with the 'y' command. I have windows hotkeys enabled so by pressing ctrl-c i can achieve this but was hoping to get rid entirely of these windows commands in vim.

Is this possible? also what about vice versa copying from windows and pasting into vim

thanks in advance

+6  A: 

I don't see any harm in using Windows command keys in GVim. Alternatively, you can also use the hotkey "+y for yanking (copying) and "+p for pasting to and from the system clipboard. This works on most platforms (Vim instances that are not directly attached to an X server on unix are a bit more difficult).

Konrad Rudolph
I believe that should read "* (quote for selecting buffer, asterix for system clipboard), or am I mistaken?
roe
You are mistaken - search for "cliboard" in the gvim help
anon
Sorry, ignore that - I guess the answer is you can use both!
anon
You can use both. Why the downvote?
Konrad Rudolph
@konrad if you are talking to me, I actually upvoted you. My comments were directed @roe. Gosh, I wish these comments were threaded!
anon
+6  A: 

Don't use windows bindings as you then won't be able to be as good in Vim on other platforms.

Use "*y - copy to system clipboard. It works well on Mac Os, Windows, Linux.

Mykola Golubyev
"*y? that is "quote - asterisk - y"?
innaM
I don't agree with your reason not to use the Windows binding. Besides the fact that a text editor is not an operating system (except for these emacs users out there) and that UI idioms change from OS to OS anyway, Command+C is actually the same across all systems known to me (even though OS X …
Konrad Rudolph
(cont'd) … uses an “own” command key (across all applications!) while Windows and Linux GUIs use the control key).
Konrad Rudolph
@Konrad: why should we make our life more complicated and get used to different key bindings among OSes if Vim already gives us all we need.
Mykola Golubyev
+6  A: 

as per above answers:

"*y
"*p

Using ctrl-v will make entering control characters tough in insert mode, and ctrl-v is visual-block in normal mode, although so is ctrl-q.

Personally have found the following quite natural & little finger friendly

vmap <a-c> "*y 
imap <a-p> "*p
dysmsyd
+1  A: 

If you want to copy from a window (or from vim), try :

:set paste

But be careful other options may be modified. Everything is detailed in :

:help paste

Hope it helps.

Taurus Olson
+1  A: 

I have

set clipboard=unnamed

in my ~/.vimrc. Then "yy", "D", etc, yank directly to the Windows clipboard. It also works in MacVim. For Linux gvim, you have to remember to prefix these operations with "+

George V. Reilly