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

fix: in some cases the syntax file can be evaluated before ftplugin #152

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

lelutin
Copy link
Collaborator

@lelutin lelutin commented Sep 12, 2024

Two users, @shadowwa and @dmaes reported errors where vim 9.1 was not happy about the variable g:puppet_display_errors not being defined when evaluating syntax/puppet.vim. They found out that the order the plugin scripts were loaded did not reflect my current understanding of how vim loads plugin files: the syntax file was loaded before the ftplugin script, so the variable was indeed not yet defined.

Since the variable is only used in the syntax script, we can declare its default value there if the variable doesn't exist (instead of in the ftplugin file)

I've also changed to using the more common values 0/1 for binary flags in order to use vimscript's "truthy/falsy" nature of a variable.

(Closes: #151)

Two users, @shadowwa and @dmaes reported errors where vim 9.1 was not
happy about the variable g:puppet_display_errors not being defined when
evaluating `syntax/puppet.vim`. They found out that the order the plugin
scripts were loaded did not reflect my current understanding of how vim
loads plugin files: the syntax file was loaded before the ftplugin
script, so the variable was indeed not yet defined.

Since the variable is only used in the syntax script, we can declare its
default value there if the variable doesn't exist (instead of in the
ftplugin file)

I've also changed to using the more common values 0/1 for
binary flags in order to use vimscript's "truthy/falsy" nature of a
variable.

(Closes: #151)
@lelutin lelutin merged commit 25a8454 into master Sep 12, 2024
3 checks passed
@lelutin lelutin deleted the fix_syntax_global_var branch September 12, 2024 21:59
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

Successfully merging this pull request may close these issues.

if puppet_display_errors is not defined in .vimrc the plugin thrown an error
1 participant