vim-erlang / vim-erlang-tags

Generate Vim tags for Erlang files
https://vim-erlang.github.io
Other
61 stars 23 forks source link

Check vim-erlang-tags options on each call #5

Closed sedrik closed 11 years ago

sedrik commented 11 years ago

If pathogen is used to handle plugins in conjuntion to a autocmd for configuring the plugins on load (to be able to detect if a plugin exists or not as pathogen loads them after vimrc has been read) the script_opts would not have been set and calling ErlangTags would ignore it.

sedrik commented 11 years ago

Here is a commit showcasing how I load plugin settings for ErlangTags.

https://github.com/sedrik/vim-configuration/commit/7b3e26ad92dc84b71f6e50ce900dbcc85c1560ca

hcs42 commented 11 years ago

The commit looks mostly good: my only suggestion is to use script_opts instead of s:script_opts (since now this variable is used only locally).

But I'd like to understand the deeper issue too. According to your comment above, you set g:erlang_tags_ignore in the following way:

function! ErlangTagsSettings()
    if exists(":ErlangTags")
        echom "ErlangTags detected"
        let g:erlang_tags_ignore = "apps/**/.eunit"
    else
        echom "Could not detect ErlangTags plugin"
    endif
endfunction

autocmd VimEnter * call ErlangTagsSettings()

What I still don't get is: if you simply add

let g:erlang_tags_ignore = "apps/**/.eunit"

to your vimrc (without any autocmd), would that make the old vim-erlang-tags version work, or would pathogen still interfere somehow?

sedrik commented 11 years ago

Yes the issue here is that I can't use exists in the vimrc file directly because pathogen has not loaded my plugins at the moment of vimrc parsing so delaying plugin configuration until VimEnter works around this issue. I found this information in a stackoverflow answer a while back but was unable to find it again.

There is a sort of catch 22 here, I want to see that my plugin is loaded before I set configuration but I can't see that until it is loaded and by then the settings need to be set.

Just setting the option directly in vimrc works fine with the old code as expected. My issue arose from the whole pathogen configuration setup I am switcthing to.

sedrik commented 11 years ago

Thanks for the acceptence =)