I want to copy/paste some text to vim from gedit. The original text looks like this:

copy from gedit

I start vim, press "i", then right click, paste, and get this:

pasted to vim

How could i set vim to not to do this? How can I copy/paste my text so that I don't need to delete those unnecessary tabs?


Take a look here. Basically it's the pastetoggle option.

| improve this answer | |
  • wow, thanks! This one really works under Fedora 14. But when i want to try it on openwrt i press F2, and it inserts a "Q" rather then going to paste mode. what hotkey is working under openwrt? – LanceBaynes Mar 7 '11 at 9:50
  • @user62367, that's strange... Alternatively you can use, in normal mode the commands :set paste and :set nopaste. – Mr Shunz Mar 7 '11 at 10:55
  • 1
    i tried it, but it didn't work under openwrt 10.03 vim - 7.1-3 :\ but thank you!! – LanceBaynes Mar 7 '11 at 14:52

It may be that your vim is not aware of the X11 clipboard or cutbuffer. Instead of running vim at the command line, run gvim -v instead. That will give you a terminal Vim, but with the X11 features enabled. Then pasting with the mouse, e.g. using the middle mouse button, should just work.

If that works, then you can add

alias vim='gvim -v'

to your ~/.bashrc file to use gvim when you execute vim.

Vim can be built with full support for X11 and the mouse, but many distributions don't do that.

| improve this answer | |

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.