Unable to paste text into vim using mouse middle-click

I just migrated from Ubuntu to Manjaro, and I believe there is a new (to me) default setting in Manjaro’s vim that is preventing me from pasting text into a vim session in text insert mode.

I can select text in one terminal, and middle-click my mouse to paste it into gedit or another terminal. It also works if I paste it into a vi session. But not when my target application is vim. This is also the case when pasting text into a root user vim session, which is not running with any .vimrc customizations.

I’m using a fresh install of Manjaro GNOME 21.2.6-220416.

Try pasting content into vim by pressing ctrl+ shift+v. Most of the time it works, using context menus in commandline based applications tends to be problematic in the first place.

Ctrl+Shift+v does work to paste and is a good workaround, thank you.

I’m pretty sure the root cause of this problem is from a vim config option that I can override in my ~/.vimrc file, I’m just not sure what that option would be.

Within vim you woul yank and paste with yy and pp respectively. The workaround i mentioned is fir accessing the clip board. It is also working within most terminals.

Alright, I found the source of the problem. Manjaro’s default vim config from the vim-runtime package (/usr/share/vim/vim82/defaults.vim) sets mouse=a:

" In many terminal emulators the mouse works just fine.  By enabling it you
" can position the cursor, Visually select and scroll with the mouse.
" Only xterm can grab the mouse events when using the shift key, for other
" terminals use ":", select text and press Esc.
if has('mouse')
  if &term =~ 'xterm'
    set mouse=a
    set mouse=nvi

I’m using gnome-terminal, which has a value of ‘xterm-256color’ for term. The fix for this would be to unset mouse in ~/.vimrc, or depending on your goals, this post suggests that setting it to ‘r’ or ‘v’ might be a better options:


Good that you found a solution, that satisfies your needs, the idea of using a mouse in combination with vim, was so strange to me that your question didn’t penetrate my thick skull fully.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.