So I have a plugin that I am writing which should allow the user to set whether they want to enable a feature. I want the feature to be disabled by default, and allow the user to change it by adding something like this to their .vimrc
let g:myplugin_enable_feature = 1, though when the user doesn't set the variable in their vimrc, it throws an error, as the variable is undefined.
I can fix the error by defining the variable inside of my plugin script, though when I do that, the user loses the ability to change the variable.
What is the proper way to allow the user to decide whether they want to change an option, without vim throwing an error when the user doesn't do anything?