Unable to copy/paste in MinGW shell

MingwCopy Paste

Mingw Problem Overview


I just installed MinGW on Windows and I'm unable to copy/paste as I am used to on Linux or even PuTTY. What is the trick for copying and pasting text (e.g. from chrome) into MinGW shell?

Mingw Solutions


Solution 1 - Mingw

Right-click on the title bar of the command window and select 'Properties', then on the 'Options' tab tick the box for the 'QuickEdit mode', then click 'Ok'.

After that you can paste text from the clipboard using the right mouse-button, highlight text while holding down the left mouse-button and copy selected text using the ENTER key.

This procedure works on Windows 7/8, not Windows 10.

Solution 2 - Mingw

[Alternative] For MINGW64 (mintty 2.7.9) terminal in Windows 10, you can enable "Ctrl+Shift+letter shortcuts" to perform copy with (Ctrl+Shift+c) and paste with (Ctrl+Shift+v).

To enable the feature:

  1. right-click command window
  2. Click on 'Keys'
  3. Check the box for 'Ctrl+Shift+letter shortcuts'

When you vi/vim into a file:

  • To copy: highlight the portion you want and click 'y'
  • To cut: highlight the portion you want and click 'd'
  • To paste: Ctrl+Shift+v

Solution 3 - Mingw

This mintty bug CTRL + C & CTRL + V copy paste addresses the issue. It allows normal Control-C, Control-V copy and pasting, but at the expense of changing other control characters. So to stop a process running you need Control-Shift-C, to interrupt it you would need Control-Shift-Z and to send an EOT you need Control-Shift-D. You may find the advantage of windows copy and paste outwights the disadvantages.

The behavior needs a flag to be set in the .minttyrc file. WHich should look like

CtrlShiftShortcuts=yes
CtrlExchangeShift=yes

Solution 4 - Mingw

Win7 running MINGW64 (mintty 2.7.3) which came with the current version of Git Bash 2.1.3.0 from date of this comment.

Right click title bar of shell > Mouse > under Click actions > Right mouse button > select the Paste radio button.

However, I was surprised to find this didn't allow me to paste using my right click on my mouse.

I had to also select Application mouse mode > Default click target > Window

After changing both settings I was able to paste.

So it seems the new shell that comes with the current version of Git bash has new features. It also seems to be a bit buggy. For instance running an an executable via cli (e.g. php -version results in empty output and forces me to restart the shell). Waiting for a new update, hopefully which will fix this.

Solution 5 - Mingw

@mrt's solution above is permanent. Here's a quicker way for any 16bit prompt in Windows:

COPY

Click on the icon on the top left > Edit > Mark, select the text and then right-click

PASTE

Similar process as above (use Edit > Paste) OR just press INSERT key

Solution 6 - Mingw

I ran into this problem and above solutions didn't work for Windows 10. This is because there is no Properties on the Menu. However with the above solution content, I was able to resolve it for Windows 10 as follows: Right click the icon on the top left hand corner of MINGW64: Select Options Now Select keys On the right hand you will find Shortcuts If not thicked, thick Copy and Paste Now always remeber the instruction given to copy & paste as follows: Copy: Ctrl+ Ins (insert) i.e. To copy on MINGW, only highlight whatever you want to copy, then press Ctrl Insert keys Paste; Shift+ Ins (insert) i.e. To paste, place your cursor where you want paste. Then press Shift Insert keys

Now select Mouse On the right hand you will find Mouse functions If not thicked, thick Copy on select and Copy as rich text For mouse button, thick Right mouse paste Note: to copy on MINGW, simply highlight whatever you want to copy. Then place your cursor where you want paste. then click the mouse right button. Now click save or Apply then Save. I have tried these and everything is fine. Note that you can also copy from any other source and use paste to MINGW using the paste instructions above.

Solution 7 - Mingw

I prefer running the MSYS2 shell inside Console2 or ConsoleZ. This allows setting right-lick for paste and copy on select, just like in Linux and PuTTY. It also combines multiple MSYS2 shells in one window with tabs.

Windows 11 also has a similar terminal program now, but I haven't tried it yet with MSYS2...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser788171View Question on Stackoverflow
Solution 1 - MingwAndreasView Answer on Stackoverflow
Solution 2 - MingwBokkers LingView Answer on Stackoverflow
Solution 3 - MingwSalix albaView Answer on Stackoverflow
Solution 4 - Mingwmdo123View Answer on Stackoverflow
Solution 5 - MingwDeepak ThomasView Answer on Stackoverflow
Solution 6 - MingwOlu AdabonyanView Answer on Stackoverflow
Solution 7 - MingwBrecht SandersView Answer on Stackoverflow