I would like to have two features in VIM

  1. Mouse Cursor Movement
  2. Paste from global clipboard with middle mouse

For the first feature I can set mouse=a and the second mouse=r.

Separately these features work but not together.

If I set mouse=ar

  • mouse cursor move [OK]
  • middle button mouse paste using information selected within vim [OK]
  • middle button mouse paste using information selected from external app [FAIL]

Is it possible to get these feature in same time without install extra applications /packages ?

$ vim --version | grep clipboard -clipboard +iconv +path_extra -toolbar +eval +mouse_dec +startuptime -xterm_clipboard

Thanks for your help

Edit I was told that I can use shift+middle mouse button to paste from external selection. This could do the job, if there was a way to merge both internal and external buffer (selection). In such case how to enter in insert mode when shift+middle mouse button is used ?

New contributor
bioinfornatics is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    To paste external text in xterm you should use ctrl+shift+v, in fact most shorcuts needs to be altered with shift in order to work in a terminal emulator in linux. To enter insert mode in vim use the insert key. – dmb Oct 11 at 14:35
  • thanks for your comment – bioinfornatics Oct 12 at 7:45
  • About the insert mode, I am looking to add a trigger or an event handler from normal mode nmap which enter in insert mode paste primary buffer and come back to normal mode while using shift+middlemouse – bioinfornatics Oct 12 at 7:58

The X Clipboard has interesting behavior. There are three selections, or clipboards if you will:

  • CLIPBOARD : interact with Ctrl-c, Ctrl-v, or Edit menus.
  • PRIMARY : interact with Shift+Insert or middle-mouse.
  • SECONDARY : mostly unused and out of scope for this.

Not all terminal emulators support middle-mouse pasting, as alluded to by @dmb. In your case, the information that you're trying to paste with middle-mouse is being stored in CLIPBOARD which is not accessed via middle-mouse. However, understanding where your information is being copied to will help you in understanding how to extract that information. Beyond that, I suggest you find a clipboard manager that provides a satisfactory workflow.

Your Answer

bioinfornatics is a new contributor. Be nice, and check out our Code of Conduct.
 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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