Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Undefined variable error for g:vim_json_warnings #30

Closed
chdiza opened this Issue · 4 comments

2 participants

@chdiza

I think the json.vim syntax file should be usable all by itself, and not require the other files in this repo. Currently it isn't usable like that, because on line 49 (and later on 114) there is this: if (g:vim_json_warnings == 1).

If the user hasn't predefined g:vim_json_warnings, then this causes an error message to appear. That variable is predefined in the ftplugin, but not in the syntax file itself.

I think what's needed is if exists("g:vim_json_warnings") && g:vim_json_warnings==1

@chdiza

PR in #32 :)

@elzr
Owner

Hmm... that's a good point @chdiza. I only just added that g:vim_json_warnings check 2 days ago. I wonder though if it shouldn't be if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1, so that in the standalone mode you mention (json.vim syntax file only) displaying warnings is the default. What do you think?

@chdiza

Well, that's totally up to you. Notice that under your most recent suggestion, there's no reason to set the variable to 1 in the ftplugin; warnings would be on unless the user explicitly unsets them.

@elzr
Owner

Thanks for the attention to detail. :) I ended up defaulting to displaying warnings because I think it's half the point of the plugin (the other half being the concealing). I'm still setting the variable to 1 in the ftplugin, for consistency & clarity, even if logically unnecessary.

@elzr elzr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.