0

On Linux, how to uninstall a plugin in Vim 8 other than removing the plugin code using a Linux command line rm command? That is to say, is there a way to remove a plugin while in a Vim 8 session and (therefore) does not require a user to go to the Linux command line? Like :PlugClean <plugin name>? Or perhaps something in the .vimrc file that can be added? Is there a packdelete plugin which does the opposite of packadd plugin.

I am using the Vim 8 native plugin manager and I want to stick with that plugin manager.

3
  • FWIW vim8 doesn't have "native plugin manager", so it is up to you or real plugin manager (like minpac) to take care of "managing" plugin un/installation.
    – Maxim Kim
    Jul 25 at 5:59
  • @MaximKim shapeshed.com/vim-packages
    – tale852150
    Jul 25 at 6:08
  • Packages support is a super nice feature... but it is not plugin manager at all. Have a look at minpac that uses packages feature of vim and can install/update/remove packages.
    – Maxim Kim
    Jul 25 at 6:09
3

There's a conceptual misunderstanding here. What Vim routinely calls "a plugin" is rather "a configuration extension". Once a script file was loaded, it is cached into RAM and never forgotten until application ends. (It still could be overwritten but it's not the same thing as "removing").

Some "plugin managers" may have implemented :PlugClean or similar command. However, in practice it's just a wrapper over rm tool. (Something you can easily do yourself if you really wish).

Concerning :packadd, it scans opt sub-tree and adds an ("optional") plugin into &runtimepath. However, as I already said, once a plugin was added, the user is not able "to undo" this, and hence "the opposite to packadd" cannot be implemented.

4
  • Excellent answer. But is there an equivalent”:PlugClean” for the Vim 8.x native plug-in manager? Or are we left with just doing an “rm” from the command line?
    – tale852150
    Jul 25 at 12:08
  • Also, if one cannot uninstall a plug-in other than removing or renaming the plug-in code, can a plug-in be temporarily “disabled” using the Vim 8.x native plug-in manager? I noticed that on Vim 8.c startup you can ignore all plug-ins but I’m interested on how to disable only one.
    – tale852150
    Jul 25 at 12:18
  • @tale852150 1. No builtin command exists; user has to do :!rm -rf dirname or :call delete("dirname", "rf") himself. 2. To skip loading a plugin there are two options: a) put it under opt and load it with :packadd only if really needed, or b) define a "guard variable", like let g:loaded_pluginname = 0 in your vimrc. This is not a language feature but rather a common convention that mostly used to bypass standard plugins shipped with Vim.
    – Matt
    Jul 25 at 12:43
  • Thank you again for your input. It has been very helpful.
    – tale852150
    Jul 25 at 12:45
0
  1. Remove the plugin line for the specific plugin in your .vimrc. -Ex. Plug 'myplugin/myplug'
  2. Save file.
  3. Source your .vimrc file. Execute source from command mode.
  4. Execute PlugClean

The above steps works for vim-plug. Replace PlugClean with PluginClean for vundle.

6
  • Does it matter if the plug-in is a filetype or global plug-in?
    – tale852150
    Jul 27 at 13:14
  • Also, I’m looking on how can this be done with the Vim 8 native plug-in not the vim-plug plug-in manager.
    – tale852150
    Jul 27 at 13:16
  • As Matt said above, native package manager requires a little intervention. My apologies for missing that portion of the question.
    – Zach W
    Jul 27 at 14:31
  • not a problem- no need to apologize. But with vim-plug, does PlugClean work differently between filetype vs global plug-ins? Thx.
    – tale852150
    Jul 27 at 14:34
  • Welcome to Vi and Vim!
    – D. Ben Knoble
    Jul 27 at 14:55

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.