1

First, apologies for attempting to ask a complicated question since I would not be able to provide a lot of details, however, one might catch something that I am missing.

I have a vim script, that is a series of stages that prepare dein.vim as a plugin loader. The problem I am experiencing is that if I put my script (single file) inside $HOME/.vim/plugin/my_dein_bridge.vim it is not working properly. I know that I should be explaining the errors etc., however, there are fundamental problems, so let's say that the script is not doing what it is intended to do and acts buggy.

However, If I just put that very same script file somewhere, let's say inside /some/path/my_dein_bridge.vim and simply source it at the end of my .vimrc file. It is working perfectly.

Maybe, someone can point to something that I need to be careful about, in regards to scripts running from the $HOME/.vim/plugin folder.

--- EDIT ---

Just to provide some additional information as much as I can. The script is intended to function as a bridge between the .vimrc file and the rest of vim's start-up, providing a safe environment for the plugin loaders.

1) .vimrc

2) bridge-boiler-plate: (this is us)

  • Make sure the plugin manager is installed
  • Run plugin manager's prep stages
  • Load some low-level plugins using the plugin manager
  • Create a list of active plugins plus some other stages etc.
  • Pass control over to the plugin manager

3) plugin manager takes on, loads the standard plugins

4) Proceed into vim-start up.

I thought having a source /some/path/my_boulerplate_bridge.vim in my .vimrc is a bit ugly, so I tried to come up with a more elegant way.

1 Answer 1

2

Everything which is in {rtp}/plugin is automatically sourced after the .vimrc has been sourced in the order specified by 'rtp'.

Now, you may observe interferences. If your plugin isn't properly isolated and depends-on/defines global variables and/or global functions, you may observe troubles.

I did provide best practices on SU: https://superuser.com/questions/147069/vim-plugin-creation-tutorial

Also, be sure to prevent recursivity, i.e. to prefer :normal! over :normal, to prefer nore forms for mappings and abbreviations, and so on.

Now without the exact error message, it'll be quite complex to provide more assistance.

2
  • Thanks. In that case, I think I have to keep my script outside the ./plugin structure. It is a bootstrap script that is intended to sit between .vimrc and the plugin loading sequence. Just to make sure that the plugin loader does not error on missing bits.
    – mbilyanov
    Commented Oct 23, 2018 at 16:38
  • It makes sense in that case. Commented Oct 23, 2018 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.