Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I copy/paste in WSL terminal? #1482

Closed
jplew opened this issue Jun 23, 2019 · 25 comments
Closed

How do I copy/paste in WSL terminal? #1482

jplew opened this issue Jun 23, 2019 · 25 comments
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Issue-Question For questions or discussion Product-Terminal The new Windows Terminal. Resolution-Answered Related to questions that have been answered

Comments

@jplew
Copy link

jplew commented Jun 23, 2019

In Powershell, I noticed that ctrl+shift+v pastes the contents of the clipboard. ctrl+shift+c does not copy anything, it just falls back to ctrl+c which is mapped to esc.

In my Ubuntu terminal, however, ctrl+shift+v does not paste. It seems the only way to copy/paste is to use right-click. Is there a way to add custom keybindings to copy/paste?

Poking around the source code I found CopyText and PasteText shortcuts:

image

However, when I tried to add them to profiles.json like this, nothing happened, those keybindings don't paste anything:

image

Any pointers?

@jplew jplew added the Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs label Jun 23, 2019
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 23, 2019
@Shorotshishir
Copy link

@jplew while in terminal everything u mark with the mouse is copied automatically,
right-click to twice to paste. (works for all terminal)

@jplew
Copy link
Author

jplew commented Jun 23, 2019

@Shorotshishir thanks for the reply. What if I don't want to use the mouse though? Is there a keyboard shortcut for it?

@Shorotshishir
Copy link

Adding with this issue, while in the terminal the new clipboard functionality doesn't work properly. If the terminal is active windows+v and click, copies the data but "uses ctrl+v" as the command to paste, thus it doesn't paste properly. if right clicked after that then it pastes. We do need quite a lot of tweaks to make all the things work together.

@jplew I am also going through the source code, I do believe there is a workaround. I need to dig deeper.

@mjbright
Copy link

It would be nice to have some configurable copy/paste settings.

I came to open an issue as I found copy/paste difficult to use.

I'd really like to be able to double click a word to copy, triple click to select a line.
Then shift-Insert to paste

When selecting/copying text in the old "Cmd.exe" way was tricky or buggy - sometimes it didn't paste.

@RZomerman
Copy link

in CMD and PowerShell I'm used to selecting the text, press enter and it would be copied.. doesnt work in the terminal though ;( ..

@DrMelon
Copy link

DrMelon commented Jun 24, 2019

Does Ctrl+Insert for copy and Shift+Insert for paste work for you?

@mjbright
Copy link

mjbright commented Jun 24, 2019 via email

@mrwiora
Copy link

mrwiora commented Jun 24, 2019

shift-insert works on powershell, but not on cmd and debian. missing that...

@jeffpatton1971
Copy link

Yea, it would be nice, the default is nifty, i miss the default select with mouse and then hitting enter for copy worked in powershell, and i think also in putty? but i don't recall.

@jeffpatton1971
Copy link

Just to add to my previous comment, the default right-click behavior doesn't always work...for example copying 8 characters from the terminal (select characters) and then right clicking into vscode results in my previous buffer being copied, so it's not picking up my selection?

@mmacphail
Copy link

Yeah shift + insert for WSL is a must have

@yodurr yodurr added Area-Input Related to input processing (key presses, mouse, etc.) Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. labels Jun 25, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jun 25, 2019
@jplew
Copy link
Author

jplew commented Jun 25, 2019

a PR addressing this issue was just merged into master: Connect clipboard functionality to their keybindings

Haven't tested yet. You'll probably have to build the exec yourself until new release makes it to the app store (looks like it was last updated four days ago: https://www.microsoft.com/en-ca/p/windows-terminal-preview/9n0dx20hk701)

@DHowett-MSFT
Copy link
Contributor

For the remaining requests, track #524.

@DHowett-MSFT DHowett-MSFT added Issue-Question For questions or discussion Resolution-Answered Related to questions that have been answered and removed Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jun 27, 2019
@csmac3144
Copy link

WTF Microsoft? I come back to Windows from macOS for a new project and this is what I find? I've been trying to copy/paste from this terminal all morning. You expect to bring devs to Windows this way?

@bitcrazed
Copy link
Contributor

@csmac3144 - please refer to #524 (comment) as per #1482 (comment)

@spottedmahn
Copy link

Sorry, what's the TLDR here? Can I use the keyboard to copy and paste?

As of Version: 0.7.3382.0, I still can't find a way to paste from the keyboard.

#524 (comment) leads me to release v0.4.2382.0 which says:

You can now bind Ctrl+C to copy and it’ll still send a literal ^C if you don’t have any text selected

So I have to manually configure copying 🤔? Isn't copying and pasting from the kbd table steaks? It seems like I missing something here.

@zadjii-msft
Copy link
Member

@spottedmahn You absolutely can copy/paste from/to the Windows Terminal.

By default, these are bound to Ctrl+Shift+C and Ctrl+Shift+V, respectively. These bindings were chosen for two main reasons:

  • uniformity with terminal emulators on other platforms.
  • unambiguity of Ctrl+C, which is already often used for "interrupt" in most commandline applications.

There are other threads that go into greater detail of the decision making here.

If you're unhappy with these bindings, it's very easy to change them to something you prefer. There's even a guide here that you can follow.

@LIHTU
Copy link

LIHTU commented Jan 27, 2020

Another default way to copy paste in terminal:
right click once on selected text to copy
right click anywhere else in terminal window to paste

@drewwells
Copy link

Also does not work with tmux mouse selection.

@anisg
Copy link

anisg commented Mar 25, 2020

Now we can easily copy paste by adding the keybindings in the settings:

 "globals" : 
    {
        "keybindings": [
            { "command": "copy", "keys": ["ctrl+c"] },
            { "command": "paste", "keys": ["ctrl+v"] }
        ]
    },

more on guide here

Edit: "globals" dictionnary is deprecated, you should add "keybindings" array out of it like so:

"keybindings": [
        { "command": "copy", "keys": ["ctrl+c"] },
        { "command": "paste", "keys": ["ctrl+v"] }
],

@koumaza
Copy link

koumaza commented May 4, 2020

I think this should be open.
KeyBind does not work with vim on WSL.
Because it is in Visual mode.
It works with Alacritty etc.
The easiest way to get around this is to replace it with Neovim.
AnyConv com__2020-05-04 19-09-25
https://anyconv.com/api/action/download/610ec3548487c754f34397baa565675c/?name=2020-05-04%2019-09-25.mp4

"command": "copy",
"keys":["ctrl+shift+c"]

@PathToLife
Copy link

Right click the windows bar -> properties -> check use ctrl-shift-c/v etc to paste/copy

image

@jucor
Copy link

jucor commented Jul 13, 2020

Thanks @PathToLife -- this is the only thing that worked for me, both in tmux, vim, vim-within-tmux.

@drewwells
Copy link

It boggles my mind how iPad has a better terminal than windows does. Putty was great a decade ago, and yet nothing has improved. ctrl+c/v should be the defaults for copy paste. It appears to me that windows development only happens in a gui b/c the terminals are quite unusable.

@microsoft microsoft locked as off-topic and limited conversation to collaborators Jul 30, 2020
@DHowett
Copy link
Member

DHowett commented Jul 30, 2020

@drewwells as has been noted in this thread, the default key binding for copy/paste is Ctrl+c/v for new users. You can continue to complain about our open-source project and make outdated claims, or you can continue using your iPad, but you’ll have to do both of them in a new discussion thread.

Locking as resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Issue-Question For questions or discussion Product-Terminal The new Windows Terminal. Resolution-Answered Related to questions that have been answered
Projects
None yet
Development

No branches or pull requests