Copying text outside of Vim with set mouse=a enabl

2019-01-29 14:51发布

After enabling set mouse=a, text copied inside of Vim will not paste outside of Vim. Does anybody know of a way to fix this?

Here, selecting text with the mouse turns on visual mode and disables the Copy option in the popup menu:

enter image description here

10条回答
我想做一个坏孩纸
2楼-- · 2019-01-29 15:24

You can use :set mouse& in the vim command line to enable copy/paste of text selected using the mouse. You can then simply use the middle mouse button or shiftinsert to paste it.

查看更多
Ridiculous、
3楼-- · 2019-01-29 15:25

On OSX use fn instead of shift.

查看更多
时光不老,我们不散
4楼-- · 2019-01-29 15:26

Press shift while selecting with the mouse. This will make mouse selection behave as if mouse=a was not enabled.

Note: this trick also applies to "middle button paste": if you want to paste in vim text that was selected outside, press shift while clicking the middle button. Just make sure that insert mode is activated when you do that (you may also want to :set paste to avoid unexpected effects).

OS X (mac): hold alt/option while selecting (source)

查看更多
Anthone
5楼-- · 2019-01-29 15:30

Instead of set mouse=a use set mouse=r in .vimrc

查看更多
放我归山
6楼-- · 2019-01-29 15:32

In ESC mode, when set mouse=a, select the text using mouse. This would enable the visual mode in vim. Then you can press 'y' to yank the selected text and 'p' to paste it wherever you want. This happens only within vim.

查看更多
闹够了就滚
7楼-- · 2019-01-29 15:36

If you are using, Putty session, then it automatically copies selection. If we have used "set mouse=a" option in vim, selecting using Shift+Mouse drag selects the text automatically. Need to check in X-term.

查看更多
登录 后发表回答