Category Archives: Uncategorized

copy and pasting to/from vim with middle click (on ubuntu linux)

Reading Time: 1 minutes

I used to have this very clunky way of copying and pasting from/to vim. All these tutorials online would have these “settings” you could add to .vimrc that were supposed to make it possible to “yank to a special register” or something, but I could never get them to work. So instead I would

At some point I was looking over a friend’s shoulder and discovered a much better way. The key is to install a different version of vim.

Now, I keep my mouse mode in

Then highlight text using the usual vim commands (shift-v and then any of the movement keys, such as “w” and “h” etc.)

Finally middle-click to paste the text elsewhere.

If you’re getting the beginning of text cut off when you paste into vim, make sure you’re in “mouse=a” and not “mouse=c” mode. In the latter, text will paste, but some of it will get cut off.