How to paste from PuTTY to Vim 8.0?

Scenario

From the 10th anniversary update client of Windows 10 ...

  • Open a web browser, copy / paste some text from a website (e.g. GitHub)
  • Use PuTTY 0.67 for SSH for Linux VM (e.g. Ubuntu 16 Xenial Xerus)
  • Open the file in Vim
  • Press ito switch to insert mode
  • Right click to paste clipboard content

Problem

Unfortunately, when I right-clicked in a PuTTY session, instead of pasting the contents of the clipboard, what actually happens is that Vim goes from mode INSERTto mode (insert) VISUAL. I don't think I've ever seen something like this before.

Question

Does anyone know why this is happening, and how can I paste my Windows clipboard into an SSH / Vim session?

image

+4
source share
3 answers

I solved this problem by turning off mouse mode.

:set mouse=
+1
source

This problem appears to be related to changing default values ​​for VIM version 8.0 and higher.

Previous versions turned off mouse mode ( mouse=), but the new one turned on mouse mode ( ) by default mouse=a.

There are 3 ways to deal with this situation:

  • Adapt to her . When the mouse mode is on, the new insertion method is right-clicking (at least in PuTTY).
  • . VIM, :set mouse= <enter>
  • . , VIM "C" (vim -C {filename}), Vi- .

, set mouse= .vimrc , . , .

+6

I faced the same problem

  • You just need to modify the vmrc file vim $ HOME / .vimrc
  • set the following in the file: set mouse- = a.vimrc

It worked great

0
source

Source: https://habr.com/ru/post/1658386/


All Articles