unable to copy/paste in mingw shell

人盡茶涼 提交于 2019-12-03 01:45:35

问题


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?


回答1:


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.




回答2:


[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



回答3:


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.




回答4:


@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




回答5:


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



回答6:


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.



来源:https://stackoverflow.com/questions/16363890/unable-to-copy-paste-in-mingw-shell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!