CharlesGueunet / VimFilify

Use a file instead of a variable, allows per project configuration.
GNU General Public License v3.0
0 stars 0 forks source link

timing problem during autoload? #1

Closed rkueke closed 5 years ago

rkueke commented 5 years ago

Dear Charles Excellent idea to set vim variables from a file easily by your plugin, particularly for configuring ale for c/c++.

My problem with vim8 and tpope/vim-plug: Starting vim with your plugin installed, inside .vimrc a simple function call e.g. "echom Filify#process("filename")" causes some error messages:

Error detected while processing /home/rkueke/.vim/plugged/VimFilify/autoload/Filify.vim: line 49: E127: Cannot redefine function Filify#process: It is in use line 79: E127: Cannot redefine function Filify#process_main: It is in use Error detected while processing function Filify#process[33]..Filify#process_main: line 14: E117: Unknown function: Filify#parent E15: Invalid expression: Filify#parent(a:dir) ...

  1. After continuing with vim the same function call on the vim command line works fine.
  2. Issuing a :source % runs the complete .vimrc without errors. All variable settings via VimFilify work correctly.

Maybe a timing problem with autoload? How can I correct this behavior? Kind regards, Reimund, 2018-11-20

CharlesGueunet commented 5 years ago

Dear Reimund,

Thanks for your feedback, i will investigate this as soon as I have the time (it is complicated for now). If you want to use this plugin for Ale, I would suggest to take a look at this file: ale.vim which basically setup Ale config (it use cmake and a script also on the same repo).

I will let this Issue open until I either fix the problem or complete the doc !

Best regards, Charles

rkueke commented 5 years ago

Dear Charles Thanks for the quick response. CORRECTION: The plugin manager I use is: 'junegunn/vim-plug'. I keep you informed in case ale.vim shows a similar behavior.

Kind regards, Reimund, 2018-11-20

rkueke commented 5 years ago

Dear Charles

I expected the impossible from your plugin! A plain assignment of a value to a variable in .vimrc by a plugin function cannot work because plugins are loaded after .vimrc is completely read.

The only way to do it the right way is encapsulating the VimFilify call in an augroup as you did it in ale.vim. Thanks for your support. I think we can close this issue.

Kind regards, Reimund, 2018-11-20

CharlesGueunet commented 5 years ago

Good, I will try to improve the doc on this point !

best regards, Charles