Skip to content

Conversation

@MeanderingProgrammer
Copy link
Contributor

@MeanderingProgrammer MeanderingProgrammer commented Nov 4, 2025

Description

When deactivating plugins vim.g.loaded_ variables are cleared based on a common pattern plugins use to avoid multiple initializing. The current logic handles most cases, except when a lua file has a hyphen, in which case it is unlikely to clear the correct variable.

Examples

Plugin / File Current Actual
nvim-treesitter / nvim-treesitter.lua loaded_nvim-treesitter loaded_nvim_treesitter
neo-tree.nvim / neo-tree.lua loaded_neo-tree loaded_neo_tree
lsp-zero.nvim / lsp-zero.lua loaded_lsp-zero loaded_lsp_zero
fzf-lua / fzf-lua.lua loaded_fzf-lua loaded_fzf_lua
cellular-automaton.nvim / cellular-automaton.lua loaded_cellular-automaton loaded_cellular_automaton
rest.nvim / rest-nvim.lua loaded_rest-nvim loaded_rest_nvim
rainbow-delimiters.nvim / rainbow-delimiters.lua loaded_rainbow-delimiters loaded_rainbow_delimiters
cosmic-ui / cosmic-ui.lua loaded_cosmic-ui loaded_cosmic_ui
compiler-explorer.nvim / compiler-explorer.lua loaded_compiler-explorer loaded_compiler_explorer
vim-coach.nvim / vim-coach.lua loaded_vim-coach loaded_vim_coach
cd-project.nvim / cd-project.lua loaded_cd-project loaded_cd_project
nvim-rooter.lua / nvim-rooter.lua loaded_nvim-rooter loaded_nvim_rooter
telescope-alternate.nvim / telescope-alternate.lua loaded_telescope-alternate loaded_telescope_alternate
diagnostic-hover.nvim / diagnoistic-hover.lua loaded_diagnostic-hover loaded_diagnostic_hover

Note

I looked through the first 10 pages of top and trending plugins from dotfyle and the results of a targeted github search
I found no counter examples, if the plugin file had a hyphen and used a vim.g.loaded_ variable, the variable always used underscores instead

@github-actions github-actions bot added the size/xs Extra small PR (<3 lines changed) label Nov 4, 2025
## Description

When deactivating plugins `vim.g.loaded_` variables are cleared based on
a common pattern plugins use to use avoid multiple initializing. The
current logic handles most cases, except when a lua file has a hyphen in
which case it is unlikely to clear the correct variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs Extra small PR (<3 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant