feat(loader): handle hyphens in file names when deactivating#2085
Open
MeanderingProgrammer wants to merge 1 commit intofolke:mainfrom
Open
feat(loader): handle hyphens in file names when deactivating#2085MeanderingProgrammer wants to merge 1 commit intofolke:mainfrom
MeanderingProgrammer wants to merge 1 commit intofolke:mainfrom
Conversation
## 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.
2a71933 to
28fb0f3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
loaded_nvim-treesitterloaded_nvim_treesitterloaded_neo-treeloaded_neo_treeloaded_lsp-zeroloaded_lsp_zeroloaded_fzf-lualoaded_fzf_lualoaded_cellular-automatonloaded_cellular_automatonloaded_rest-nvimloaded_rest_nvimloaded_rainbow-delimitersloaded_rainbow_delimitersloaded_cosmic-uiloaded_cosmic_uiloaded_compiler-explorerloaded_compiler_explorerloaded_vim-coachloaded_vim_coachloaded_cd-projectloaded_cd_projectloaded_nvim-rooterloaded_nvim_rooterloaded_telescope-alternateloaded_telescope_alternateloaded_diagnostic-hoverloaded_diagnostic_hoverNote
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