SirVer / ultisnips

UltiSnips - The ultimate snippet solution for Vim. Send pull requests to SirVer/ultisnips!
GNU General Public License v3.0
7.55k stars 691 forks source link

Temporarily disable plugin / Toggle #1518

Closed ei14 closed 1 year ago

ei14 commented 1 year ago

Upon searching how to toggle / temporarily disable the plugin, the following 10 year old thread appears:

https://bugs.launchpad.net/ultisnips/+bug/1255075

In this thread, SirVer sarcastically responds to a request for this feature by suggesting the user use a 3rd party plugin manager, and makes clear that the plugin is purposely in violation of the Vim guidelines.

Since the original thread was posted, Vim has changed in ways that make 3rd party plugin managers obsolete. Even the user's naive solution no longer works in the current version of Ultisnips.

UltiSnips still uses practices from 10 years ago. Currently, there is absolutely no way to toggle UltiSnips other than to completely uproot the installation of UltiSnips and violate the defaults created by the installation script. This makes installation and updating of the plugin cumbersome.

SirVer commented 1 year ago

To lead with the unpleasant: I never am sarcastic on the internet, I never was and never will be. Frankly assuming that on your part makes me feel sad, misunderstood and hence less motivated in helping out, it feels like a personal attack.

To concentrate on the matter at hand: Disabling a plugin like UltiSnips is not so easy, since it puts deep hooks into everything Vim does. Other plugins are similar and have similar issues. Because this is difficult, there are specialized tools to do so, Plugin managers are one of sort.

Since the original thread was posted, Vim has changed in ways that make 3rd party plugin managers obsolete

I feel your point is incorrect, since clearly vim's internal tool do not do what you want. And to pull one example, https://github.com/junegunn/vim-plug seems actively developed, so apparently their author agrees with me that there is still a need. I use it to disable plugins in some file types where I do not want them.

My opinions have not drastically changed, so I conclude with two quotes from the original thread:

Use Vundle and be done with that. This is out of the scope of this plugin. [edit: I'd recommend Plug these days, it is a nice tool]

If you want a plugin sometimes and sometimes not you should use a plugin manager.

RobinTruax commented 1 year ago

Hi SirVer, I've been looking in the documentation trying to find a current version of the "naive solution" which appears in the initial post of the article here:

https://bugs.launchpad.net/ultisnips/+bug/1255075

I use vim-plug, but unfortunately vim-plug does not support toggling plugins on and off on the fly (or, rather, all the solutions I have found are specialized to plugins which have some built-in enable/disable feature -- let me know if I am mistaken in this). The 'on' feature of vim-plug allows me to toggle a plugin on, but unfortunately not off.

I understand that you don't want to add a dedicated command for this, but I was wondering if there is a sequence of commands/variable assignments which would disable/enable UltiSnips without requiring me to restart vim. I don't mind if it's multiple commands as in the Launchpad post above; it's being bound to an action in a hydra anyways. To be clear, I'm not asking that such a feature be added, but wondering if some analogue to the solution in the Launchpad post still exists in some form. Thanks either way!

SirVer commented 1 year ago

@RobinTruax You can unbind the AutoCommands UltiSnips is using and rebind the triggers to something else. Alternatively you can use VimPlug to only activate UltiSnips in the filetypes where you are using it.