I've been using vi for 40 years. A week ago I upgraded; Disaster struck! The upgrade was to

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 4 2018 23:38:28)

I run this on xterm under Cygwin (under Windows 10).

I understand that I can insert text from the clipboard by pressing, e.g. 'a' followed by a middle-click of the mouse. Fine. That still works.

But for the last three decades, when in vi command mode I can execute a string of vi commands from the clipboard by pressing middle-click. THAT NO LONGER WORKS. If vi is not in insert mode it immediately goes into insert mode (as if 'a' were pressed) when I middle-click to paste.

What's happening? What's the workaround?

On another board, someone mentioned commands like

:set paste
:set nopaste
:set mouse=

I don't know what those commands are supposed to do, but none of them solves my problem.

Thanks in advance!

  • 2
    Wow! 40 years, OMG! My 23 years is just a tiny experience :-) – peterh Nov 17 '18 at 19:03

set mouse= is the fix for the problem, with set t_BE= substituted in an xterm environment. The 'bug' these fixes solve was actually intended as a 'feature': creating an obstacle to pasting vi commands would be good if malicious code were somehow inserted onto user's clipboard.

Kudos to a guy named Elijah, on another message-board, who researched and solved this problem.

  • 1
    And what's with all the "Edited by ..."??? Leaving my name on words that aren't my own??? I could understand this if someone used obscenities. But, as is, it seems like pretentious anal-retentive policing! (Though soon this remark will doubtless be edited away! ) And, BTW, in the unlikely event that you're interested in improving your user intrface, be aware that with buttons like "Save Edits" USE OF THE ENTER KEY TO MEAN "SAVE EDITS" IS REDUNDANT. Some us old fogeys like to use ... gasp! ... paragraph breaks and such! – jdallen Nov 19 '18 at 8:22
  • 2
    Dear jdallen, I cannot understand your concerns: this site is a collobarative effort by the people who ask, answer and try to improve the quality of posts. If you do not like an edit, you can raise your voice. But in your case I do not see a reason. People do not only fix formatting or tags, but also correct typos, improve English, clarify text etc. This is helpful. Regarding requests about the site itself there is a dedicated subpage vi.meta.stackexchange.com. However, your issue with comments will unlikely change. But for sure this is not the place to discuss this. – Hotschke Nov 19 '18 at 11:06

This mapping should paste from your clipboard and execute. Map it to whatever you want and you are done.

By the way the answer you posted seems to be for an entirely different purpose, and the first two lines contradict, so one of them is redundant.

  • 2
    I found the correct answer via another message board: set t_BE= is the xterm equivalent of set mouse= and solves my problem. – jdallen Nov 18 '18 at 6:03
  • 2
    And I just learned that Enter terminates comments. Friendly? The "bug" was actually a "feature": Some malicious agent might have put a virus into my clipboard. By the way, I entered these commands one by one, ignorantly trying the silly ones only when 'set mouse=' (almost correct!) failed. – jdallen Nov 18 '18 at 6:13

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.