WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Keyboard shortcuts for copy / paste into console

Open MattiasFestin opened this issue 10 years ago • 81 comments

It would be nice to have keyboard shortcut for pasting into console instead of right clicking (Or window menu -> edit -> paste).

I tend to use my keyboard as much as possible. So it would be nice to have a shortcut like git bash:

  • copy = ctrl + insert
  • paste = shift + insert

MattiasFestin avatar Apr 20 '16 19:04 MattiasFestin

Agreed, this feedback is more general Windows cmd.exe than bash-specific. Here's a workaround to make copying and pasting easier for you:

Launch cmd.exe
Right click title bar, click Properties
Options Tab
Enable QuickEdit mode

Now you can highlight text with your mouse cursor, right click to copy, right click again to paste.

benhillis avatar Apr 20 '16 19:04 benhillis

Agreed, this feedback is more general Windows cmd.exe than bash-specific

That's not entirely true, by default the new cmd.exe accepts text pasted with CTRL + V, it's only once you're in bash mode you can't paste anything with CTRL + V (not even CTRL + Shift + V like in Ubuntu terminal).

bash-copy

That's just an option in the properties (Enable shortcuts with Ctrl or something like that, my interface is not in English :) )

seb-vial avatar Apr 21 '16 07:04 seb-vial

I think using the Ubuntu Style Ctrl-Shift-C would make sense, especially as Ctrl-C is a common interrupt

I'd also like to see things like emacs mode honoured where Ctrl-A / Ctrl-K work as expected

mgleadow avatar Apr 22 '16 12:04 mgleadow

AFAIK Ctrl+A and Ctrl+K already works as expected.

mobluse avatar May 01 '16 16:05 mobluse

@mobluse So they do. They didn't work for me the other day though, odd.

mgleadow avatar May 03 '16 12:05 mgleadow

I think using the Ubuntu Style Ctrl-Shift-C would make sense, especially as Ctrl-C is a common interrupt

My toughs where the same with the Ctrl-C (and also Ctrl-V, not that common) interrupt signals.

That is why I suggested Ctrl + insert and Shift + insert. They work in windows now, so it is nothing new. And they are compatible with the Linux keyboard interrupts.

MattiasFestin avatar May 10 '16 20:05 MattiasFestin

I vote for Ubuntu terminal shortcuts Ctrl + Shift + C/X/V as a primary ones and maybe an alternative Ctrl/Shift + Insert. But that's only my preference because I use bash on Linux in most cases.

mirao avatar Jun 04 '16 09:06 mirao

Why not to provide a way to configure the terminal shortcuts for this app? I'm not a win user, i'm just reviewing it

If not, @mirao proposal +1. I'm a *nix user in most cases too, and would be great maintain the default terminal shortcuts for the major distros.

XaviTorello avatar Jun 04 '16 10:06 XaviTorello

I would like to have CTRL + Shift + C/X/V, although if possible my vote would be for it to be configurable.

GrimTheReaper avatar Jun 20 '16 19:06 GrimTheReaper

This is a current limitation in the Windows Console.

Console currently supports two input modes: 'processed' and 'raw'. In 'processed' mode, Windows Console pre-processes all keystrokes, handling several well-known chords consistently across cmd, PowerShell and elsewhere.

To better handle *NIX behavior, however Bash requests raw, un-pre-processed keyboard input. We do have a task on our backlog to add a "mildly-pre-processed" mode wherein Console will translate copy and paste key chords into the VT sequences expected by *NIX tools, shells, etc.

bitcrazed avatar Jul 03 '16 18:07 bitcrazed

You can run REG.EXE add HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f as administrator in the Windows Command Prompt to enable QuickEdit by default.

This would let you:

  • copy text by highlighting text (left clicking) and then right clicking.
  • paste text by right clicking

To disable QuickEdit run REG.EXE add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f as administrator in the Windows Command Prompt to disable it by default.

ghost avatar Aug 08 '16 18:08 ghost

I just installed "Bash on Windows" and I can copy / paste by doing

  • CTRL + SHIFT + C
  • Right Click

Pixinn avatar Aug 15 '16 13:08 Pixinn

ctrl+shift+c ctrl+shift+v is what is preferred

brnelsons avatar Oct 18 '16 19:10 brnelsons

Here's another vote for Ctrl+Ins/Shift+Ins. This seems to be the standard for TTY apps, which is how I usually interact with Linux when in Windows.

konnichimade avatar Oct 18 '16 22:10 konnichimade

+1 to Ctrl-V or some variant. Right clicking to paste works, but taking my hands off the keyboard is far from ideal.

jskopek avatar Oct 28 '16 06:10 jskopek

I agree that this should be configurable.. I, for one, would like to have either CTRL+SHIFT+C/X/Vor ALT+C/X/V (to simulate how things are done in Mac; the Command + C/X/V)... Also, it would be preferable to configure the "right click" behaviour as I'd expect it to give me a menu (to copy/cut/paste.. etc) as opposed to the "right click to paste" behaviour.. This is especially noticeable when using VIM.. ☹️

farahfa avatar Oct 28 '16 19:10 farahfa

Suggest seeing these uservoice requests in addition to upvoting here:

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13341399-bash-copy-paste

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13373574-bring-ctrl-shift-c-v-to-copy-and-paste

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13389489-better-hotkey-shortcut-integration

blakehawkins avatar Nov 28 '16 10:11 blakehawkins

Another vote for gnome-terminal style cut and paste.

The main problem is that it is using the Windows Console app, which, at least from a linux guy, sucks, and always has.

If you really want to cater to linux folks, you need a much better terminal emulator.

brennanmh avatar Feb 06 '17 20:02 brennanmh

mouse right click is not better than ctrl+shift+c\v.hope ASAP to support this function.

TestSmirk avatar Mar 07 '17 02:03 TestSmirk

There is a workaround to the WSL Bash, paste issue:

One can simply do the following steps:

  1. open cmd.exe
  2. bash -c "pasted command here" ( this works because you are in cmd.exe )

The bash will exit after the command, I don't know how, yet, to keep it running after, like, "variable assign" from the cmd console. e.g. 'bash -ic "command and remain'

n3rd4i avatar Apr 01 '17 08:04 n3rd4i