RE: How do I define a key binding for copy-to-clipboard?
At Friday, September 10, 2004 4:02 AM, jashy wrote: > If you really hate using mouse to do copy&paste, I suggest you to use > device /dev/clipboard directly. Copy to clipboard: cat somefile > > /dev/clipboard, get something from clipboard, cat /dev/clipboard > > somewhere. or use putclip and getclip from the cygutils package. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: How do I define a key binding for copy-to-clipboard?
If you really hate using mouse to do copy&paste, I suggest you to use device /dev/clipboard directly. Copy to clipboard: cat somefile > /dev/clipboard, get something from clipboard, cat /dev/clipboard > somewhere. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
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. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: How do I define a key binding for copy-to-clipboard?
On Thu, 9 Sep 2004, David Tombs wrote: > Hello All, > > 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 cygwin FAQ describes a function, 'paste-from-clipboard', which > performs the paste operation and which can be bound to an individual key > within an initrc file. Searching a bit deeper, the readline docs tell me > a bit about the format of the initrc file and how to bind Ctrl and Meta > keys. So I put the following line into my personal .initrc file > Control-v:paste-from-clipboard > and lo and behold, it works! > > However I cannot find a definition of the converse 'copy-to-clipboard' > function anywhere. It surely exists, because pressing the 'Enter' key > (or right mouse) does just that. > > So what do I have to do to bind this function operation to Ctrl-C? How > do I write into my .initrc > Control-c:{whatever Enter does} The short answer is: you can't. The long answer is that, to copy something to clipboard you need two things: a way to select text, and a program that's aware of this selection. Only if you have both of these can you assign a key inside the program to copy the selection to the clipboard. The selection in the default bash window is provided by the cmd.exe process that created the Window -- bash is not Windows- and mouse-aware. Also, when in selection mode, cmd.exe does *not* relay any keys to bash -- which you can easily verify. Once started a selection, you have to end it by either pressing Enter (or the right mouse button) to copy it to the clipboard, or Esc to cancel. Neither the Enter nor the Esc will be relayed to bash. Other key presses will be ignored, and won't be relayed to bash either. So, anything you add to .inputrc will be useless, as it won't be processed until *after* you already copied something to the clipboard. In other words, if there were a way of selecting something via *readline* means, rather than using the Windows cmd.exe functionality, readline could also provide a "copy-to-clipboard" function. Since readline has no code dealing with selection, the authors apparently saw no need for a "copy" function. Feel free to add such functionality to readline (but please take any discussion of this to the bash/readline mailing list). Hope this clarifies things, Igor P.S. Ctrl-C is traditionally used in Unix to send a SIGINT to a process, just as Ctrl-V is used to quote the next character. -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_[EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Happiness lies in being privileged to work hard for long hours in doing whatever you think is worth doing." -- Dr. Jubal Harshaw -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/