This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How do I define a key binding for copy-to-clipboard?

David Tombs wrote:

> I'm a Windows user trying to install and configure cygwin. Thus far I've
> managed to install bash and, mostly, configure it to my preferences.
> However, there is one thing missing. I want to use the clipboard to
> transfer text to and from Windows, with the same key bindings, viz
> Ctrl-C for copy and Ctrl-V for paste. (My left finger muscles are
> hardwired to these keys and anyway, I hate using the mouse for this kind
> of action.)

The short answer is that if you're using the default "Command Prompt"
then cmd.exe is handling the selection and copy operations and there's
no way to tell it to use ctrl-C as you want.  The pasting is handled
entirely by  bash so as you have found it's quite easy to make it do
what you want.

My advice would be to dump cmd.exe.  Even ignoring the issue you're
having, it does not do copy and paste properly.  It does selection as a
rectange rather than as linear text, which is how every other
text-oriented application works.  rxvt is light years ahead of cmd.exe
in terms of functionality, once you get it running with some more
pleasing colors and font than the default (IMO).  FYI I do this with a
shortcut to: (no doubt it might be easier to set these as resources
rather than on the command line; I know this.)

C:\cygwin\bin\rxvt.exe -g 130x60 -bg black -fg gray -fn "Lucida
Console-11" -sr -sl 5000 -j -cr white -sk -si -tn rxvt -e /bin/bash -li

And, it will automatically copy text when you select it, as in *nix,
which I find even easier than having to remember to press ctrl-C.

You *might* even be able to configure rxvt to recognise ^C as the
explicit copy-selection key, and disable the automatic copying.  But,
you would also have to mess with your tty settings because ^C is usually
the 'interrupt' keystroke and can be very, very hard to live without in
a posix-like environment.  You could this to some other keystroke,
though.  Try "man stty".  Also, I think Control-Break will also send the
'interrupt' key.


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]