I come from a Windows background where Cut/Copy/Paste are almost always CTRL+X/C/V respectively. I like this consistency, so adjusting to Cygwin's (or other *nix environments') use of SHIFT+INSERT or the middle mouse button for pasting in terminals is a little annoying. After a bit of googling, I found a mailing list thread that solved my problem.
This method uses a modification to readline's ~/.inputrc configuration file, so it should work in rxvt, xterm, or even the default cmd.exe shell. Here is what to do:Add the following line to your ~/.bashrc:
stty lnext ^q stop undef start undefAnd add the following line to your ~/.inputrc:
These modifications will unmap
lnext (literal next-character) and
quoted-insert settings which are normally mapped to CTRL-V.
For more details, see
this cygwin mailing list thread.
Note, this appears to be a Cygwin-specific solution. Linux users could use custom key
konsole, or translation tables
Useful commands for reference:
$ bind -p
$ stty -a
THANK YOU for this information. Why didn't I google this before?? :-)
Fair warning for those who want to try Terminator.
The stty command for Cygwin brings up an error in terminator. Apparently there's an stty.exe that was hatched without one or the other of the commands in that string. Curiously enough, the Xterm-based terminals don't seem to have this problem.
Terminator supports ctrl-v paste all on its own [it should -- it requires the Cygwin/X java and ruby files to run...for that kind of disk cost it should also polish my shoes. :)] BZT
Thanks!! is perfect.
But if I want to use Ctrl+C to copy???
use \C-c seems not work.
Thanks in advance
Thank you so much. This can help me a lot. :)
jlupbox: rxvt-cygwin (not the client or server variations that need Cygwin/X started to run right) copies by merely selecting the text. Just be careful how much you select: sometimes you can "trap" right back to your prompt (like right-hand carats or a dollar sign) which, if pasted without editing, will return a "Command not found" error in almost every shell.
Hey, it's better than nothing. rxvt-cygwin's a big-time compromise already. Just read the Cygwin mailing-list archives to see what I mean.
Anyone figured out how to pass this (ctrl-v for paste from clipboard) to scripts? It's still shift-insert on a "read" command execution in all of mine? Ctrl-V just reverts to its old binding (whatever that was) and most of the time will terminate a script (or your shell and terminal, worse still).
Thanks.. It works.. But, Cntl X won't work for cut.
Amazing thank you :)
Do you happen to know how to map the paste to ctrl-shift-v key? I have done my research, but shift is not a modifier key for readline. I wish there was something like xev where I do my keystroke and get the equivalent key (for readline, that is). Was there any file, reference, or program that helped you to figure things out?
Very cool, thanks for taking the time.
Thank you so much! This tip makes life worth living.
@John (comment #9) - I know it's been a while but since this comes out on top of my Google search results maybe it will help someone. I used sed -n l to find the keycode combination. I now have this in my .inputrc in my CygWin instance:
"\302\203": copy-to-clipboard "\302\226": paste-from-clipboard
It works. Sort of. For example, vim doesn't seem to like to paste with it but that may be a .vimrc change I need to research.