Sunday, October 21, 2012

Vim editor - Paste toggle

You may have experienced an additional spaces or unexpected indentation when you paste some text into Vim from another application. To avoid that you need to set paste toggle option in Vim

Follow the steps below

$ vim ~/.vimrc

Put the following in your vimrc (change to whatever key you want):
set pastetoggle=

save and exit.

To paste from another application:
   * Start insert mode.
   * Press F2 (toggles the 'paste' option on)
   * Use your terminal to paste text from the clipboard.
   * Press F2 (toggles the 'paste' option off).