Search code examples
vimvim-pluginviml

How to load a vimscript file after loading plugin utl.vim?


I need to source some configuration lines after loading a plugin called [utl.vim][1].

The documentation says, I need to put these configurations into after-directory:

[23] NOte that you cannot include this line in your .vimrc because it is
    :source'd before utl_rc.vim (which defines g:utl_cfg_hdl_mt_generic).
    So either include/change it at <url:config:#r=utl_cfg_hdl_mt_text_directory>
    or include it in the after-directory, see <url:vimhelp:after-directory#5.>

I created a file called utl.vim inside ~/.vim/after/ directory.

But this file is not sourced. I verified this using :scriptnames.

How to assure that Vim sources this file after loading utl.vim plugin?


Solution

  • The list of files/directories loaded by Vim is described at :help startup. Despite it lists the plugin directories, it doesn't mentions the after directory, so what you are seeing is the expected behavior.

    Usually the after directory is source for filetype plugins, as explained in Vim FAQ 26.3 - "How do I extend an existing filetype plugin?". It is possible that the plugin will run something like :runtime! after/**/*.vim, but if the documentation is unclear will should ask to the plugin author, because it would be probably easier for users to be allowed to set this variable, and them the plugin could append/prepend default values to it