Temporarily disable vim plugin without relaunching

Posted by simont on Stack Overflow See other posts from Stack Overflow or by simont
Published on 2012-03-29T19:28:14Z Indexed on 2012/03/30 5:29 UTC
Read the original article Hit count: 155

Filed under:

I'm using c-support in Vim. One of it's features is the automatic comment expansion.

When I'm pasting code into Vim from an external editor, the comments are expanded (which gives me double-comments and messes up the paste - see below for example). I'd like to be able to disable the plugin, paste, then re-enable it, without relaunching Vim. I'm not sure if this is possible.

The SO questions here, here and here all describe methods to disable plugins, but they all require me to close Vim, mess with my .vimrc or similar, and relaunch; if I have to close Vim, I might as well cat file1 >> myfile; vim myfile, then shift the lines internally, which will be just as quick.

Is it possible to disable a plugin while running vim without relaunching, preferably in a way which allows me to map a hot-key toggle-plugin (so re-sourcing ~/.vimrc is alright; that's mappable to a hotkey [I imagine, haven't tried it yet])?


Messed up comments:


/*
 *  *  Authors:
 *   *    A Name 
 *    *
 *     *  Copyright:
 *      *    A Name, 2012
 *       */

EDIT: It turns out you can :set paste, :set nopaste (which, to quote :help paste, will "avoid unexpected effects [while pasting]". (See the comments).
However, I'm still curious whether you can disable/enable a plugin as per the original question, so I shall leave the question open.

© Stack Overflow or respective owner

Related posts about vim