Closed lehmacdj closed 2 years ago
I just checked and it looks like g:neuron_dir is being populated correctly in plugin/neuron.vim. However, I think what's going on is that ftdetect/neuron.vim is executed before g:neuron_dir has a chance to be initialized.
I don't really have an idea for a more elegant remedy than this PR, but maybe we should instead of using get for accessing default variables, access them using an autoload function, i.e. neuron#neuron_dir() that takes care of initializing the global when it is first called if uninitialized before?
@fiatjaf or @fenetikm gentle ping here too.
I'm not super happy with how I'm solving this here, would be open to a better suggestion that can also solve this problem if you have one.
I don't understand what you did here or your suggestions about autoload functions, but you clearly know much more vimscript than me.
While running neuron on my system I noticed that ftdetect wasn't creating the augroups because
get(g:, 'neuron_dir')
returned 0 instead of the current directory as expected. I was able to work around this issue by supplying an explicit default toget
.