Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How disable a plugin without removing it? #432

Closed
cjnucette opened this issue Jun 29, 2021 · 5 comments
Closed

Question: How disable a plugin without removing it? #432

cjnucette opened this issue Jun 29, 2021 · 5 comments

Comments

@cjnucette
Copy link

You can do this in vim-plug by commenting the corresponding line, but with packer the plugin is always loaded because is in the rtp, which is not the case with vim-plug. I want to be able to disable some plugins to create a minimal init.vim without the need to run :PackerClean.

@akinsho
Copy link
Collaborator

akinsho commented Jun 29, 2021

@cjnucette you can prevent plugins from loading by making them opt=true this will move them out of the start directory where all plugins are loaded automatically. The difference between packer and vim-plug here is that packer uses vim's native packages feature which you can read more about under :help packages whilst plug doesn't. Packages do come with a few gotchas such as this for example though.

Alternatively, if this is something you might want to do a lot you can create a pattern for it, e.g.

-- outside of packer startup probably
local function minimal()
  return vim.env.MINIMAL == nil
end

packer.startup(function(use)
  use {"a/plugin", cond = minimal}
end)

When you start vim and want a minimal init you can run

MINIMAL=true nvim

@akinsho
Copy link
Collaborator

akinsho commented Jun 29, 2021

FWIW there's some discussion around making all plugin opt by default and packer loading them itself, which will make things like creating a minimal init.vim easier to do (see #50)

@cjnucette
Copy link
Author

Thanks, I'll try this.

@akinsho
Copy link
Collaborator

akinsho commented Jun 29, 2021

I should also mention that after adding opt=true you need to run PackerSync

@wbthomason
Copy link
Owner

See #307 and #402 (discussion) as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants