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

Closed
opened 2026-01-30 22:44:13 +00:00 by claunia · 25 comments
Owner

Originally created by @jplew on GitHub (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?

Originally created by @jplew on GitHub (Jun 23, 2019). <!-- What needs to change? Who is responsible for it? Why is it an open question? --> 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](https://user-images.githubusercontent.com/462836/59979370-eec70280-959b-11e9-8b2b-18c6e2de3918.png) However, when I tried to add them to profiles.json like this, nothing happened, those keybindings don't paste anything: ![image](https://user-images.githubusercontent.com/462836/59979383-13bb7580-959c-11e9-88b2-a302bca10d52.png) Any pointers?
claunia added the Issue-QuestionArea-InputResolution-AnsweredProduct-Terminal labels 2026-01-30 22:44:13 +00:00
Author
Owner

@Shorotshishir commented on GitHub (Jun 23, 2019):

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

@Shorotshishir commented on GitHub (Jun 23, 2019): @jplew while in terminal everything u mark with the mouse is copied automatically, right-click to twice to paste. (works for all terminal)
Author
Owner

@jplew commented on GitHub (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?

@jplew commented on GitHub (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?
Author
Owner

@Shorotshishir commented on GitHub (Jun 23, 2019):

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.

@Shorotshishir commented on GitHub (Jun 23, 2019): 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.
Author
Owner

@mjbright commented on GitHub (Jun 23, 2019):

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.

@mjbright commented on GitHub (Jun 23, 2019): 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.
Author
Owner

@RZomerman commented on GitHub (Jun 24, 2019):

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

@RZomerman commented on GitHub (Jun 24, 2019): in CMD and PowerShell I'm used to selecting the text, press enter and it would be copied.. doesnt work in the terminal though ;( ..
Author
Owner

@DrMelon commented on GitHub (Jun 24, 2019):

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

@DrMelon commented on GitHub (Jun 24, 2019): Does _Ctrl+Insert_ for copy and _Shift+Insert_ for paste work for you?
Author
Owner

@mjbright commented on GitHub (Jun 24, 2019):

From my point of view it's a pain each time I switch from one Terminal type
to another having to remember/learn different ways of
selecting/copying/pasting which is why I'd really push for providing a
choice.

Personally I've got used to and am very happy with (with MobaXTerm):

SELECTION:

  • single-click drag to select whatever I want
    double-click to select a word
    triple-click to select a line

COPY: well it was already done thank you when you selected (Nice)

PASTE:

  • shift-Insert

I guess good selection with auto-copy is the most important to me, then I
can adapt to Shift-Insert, Ctrl-V, "stand on my chair and shout" or
whatever ...

I think allowing this to be a profile setting would satisfy a lot of people.

On Mon, 24 Jun 2019 at 11:07, J. Brown notifications@github.com wrote:

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


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/terminal/issues/1482?email_source=notifications&email_token=AAOLALJZRDXIOADBV4INNF3P4CFFFA5CNFSM4H2ZKHMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYMIZQI#issuecomment-504925377,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAOLALLF5FNI6YIUOTJJOSDP4CFFFANCNFSM4H2ZKHMA
.

--

Cloud Native Training in English or French
-Kubernetes, Docker
-Serverless
-Micro-services
-Python, Git

@mjbright commented on GitHub (Jun 24, 2019): From my point of view it's a pain each time I switch from one Terminal type to another having to remember/learn different ways of selecting/copying/pasting which is why I'd really push for providing a choice. Personally I've got used to and am very happy with (with MobaXTerm): SELECTION: - single-click drag to select whatever I want double-click to select a word triple-click to select a line COPY: well it was already done thank you when you selected (Nice) PASTE: - shift-Insert I guess good selection with auto-copy is the most important to me, then I can adapt to Shift-Insert, Ctrl-V, "stand on my chair and shout" or whatever ... I think allowing this to be a profile setting would satisfy a lot of people. On Mon, 24 Jun 2019 at 11:07, J. Brown <notifications@github.com> wrote: > Does *Ctrl+Insert* for Copy and *Shift+Insert* for paste work for you? > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/microsoft/terminal/issues/1482?email_source=notifications&email_token=AAOLALJZRDXIOADBV4INNF3P4CFFFA5CNFSM4H2ZKHMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYMIZQI#issuecomment-504925377>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAOLALLF5FNI6YIUOTJJOSDP4CFFFANCNFSM4H2ZKHMA> > . > -- Cloud Native Training in English or French -Kubernetes, Docker -Serverless -Micro-services -Python, Git
Author
Owner

@mrwiora commented on GitHub (Jun 24, 2019):

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

@mrwiora commented on GitHub (Jun 24, 2019): shift-insert works on powershell, but not on cmd and debian. missing that...
Author
Owner

@jeffpatton1971 commented on GitHub (Jun 24, 2019):

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 commented on GitHub (Jun 24, 2019): 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.
Author
Owner

@jeffpatton1971 commented on GitHub (Jun 24, 2019):

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?

@jeffpatton1971 commented on GitHub (Jun 24, 2019): 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?
Author
Owner

@mmacphail commented on GitHub (Jun 24, 2019):

Yeah shift + insert for WSL is a must have

@mmacphail commented on GitHub (Jun 24, 2019): Yeah shift + insert for WSL is a must have
Author
Owner

@jplew commented on GitHub (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)

@jplew commented on GitHub (Jun 25, 2019): a PR addressing this issue was just merged into master: [Connect clipboard functionality to their keybindings](https://github.com/microsoft/terminal/pull/1093#event-2438652452) 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)
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 27, 2019):

For the remaining requests, track #524.

@DHowett-MSFT commented on GitHub (Jun 27, 2019): For the remaining requests, track #524.
Author
Owner

@csmac3144 commented on GitHub (Aug 27, 2019):

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?

@csmac3144 commented on GitHub (Aug 27, 2019): 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?
Author
Owner
@bitcrazed commented on GitHub (Aug 28, 2019): @csmac3144 - please refer to https://github.com/microsoft/terminal/issues/524#issuecomment-525372271 as per https://github.com/microsoft/terminal/issues/1482#issuecomment-506525945
Author
Owner

@spottedmahn commented on GitHub (Dec 9, 2019):

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.

@spottedmahn commented on GitHub (Dec 9, 2019): 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)](https://github.com/microsoft/terminal/issues/524#issuecomment-525372271) leads me to [release v0.4.2382.0](https://github.com/microsoft/terminal/releases/tag/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.
Author
Owner

@zadjii-msft commented on GitHub (Dec 9, 2019):

@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.

@zadjii-msft commented on GitHub (Dec 9, 2019): @spottedmahn You absolutely can copy/paste from/to the Windows Terminal. By default, these are bound to <kbd>Ctrl+Shift+C</kbd> and <kbd>Ctrl+Shift+V</kbd>, respectively. These bindings were chosen for two main reasons: * uniformity with terminal emulators on other platforms. * unambiguity of <kbd>Ctrl+C</kbd>, 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](https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingJsonSettings.md#adding-copy-and-paste-keybindings) that you can follow.
Author
Owner

@LIHTU commented on GitHub (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

@LIHTU commented on GitHub (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**
Author
Owner

@drewwells commented on GitHub (Feb 29, 2020):

Also does not work with tmux mouse selection.

@drewwells commented on GitHub (Feb 29, 2020): Also does not work with tmux mouse selection.
Author
Owner

@anisg commented on GitHub (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"] }
],
@anisg commented on GitHub (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](https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingJsonSettings.md#adding-copy-and-paste-keybindings) 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"] } ], ```
Author
Owner

@koumaza commented on GitHub (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"]
@koumaza commented on GitHub (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://user-images.githubusercontent.com/44153315/80956154-9a3b1780-8e3b-11ea-98ed-ac2a90127627.gif) https://anyconv.com/api/action/download/610ec3548487c754f34397baa565675c/?name=2020-05-04%2019-09-25.mp4 ``` "command": "copy", "keys":["ctrl+shift+c"] ```
Author
Owner

@PathToLife commented on GitHub (Jun 16, 2020):

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

image

@PathToLife commented on GitHub (Jun 16, 2020): Right click the windows bar -> properties -> check use ctrl-shift-c/v etc to paste/copy ![image](https://user-images.githubusercontent.com/12622625/84766678-58e67c00-b025-11ea-8145-386ed95829f3.png)
Author
Owner

@jucor commented on GitHub (Jul 13, 2020):

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

@jucor commented on GitHub (Jul 13, 2020): Thanks @PathToLife -- this is the only thing that worked for me, both in tmux, vim, vim-within-tmux.
Author
Owner

@drewwells commented on GitHub (Jul 30, 2020):

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.

@drewwells commented on GitHub (Jul 30, 2020): 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.
Author
Owner

@DHowett commented on GitHub (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.

@DHowett commented on GitHub (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 in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#2007