niklaas / lightline-gitdiff

Show added, deleted and modified lines (`git diff`) in your statusline or lightline
Other
27 stars 4 forks source link

E117: Unknown function: lightline#update when attempting to use without lightline #1

Closed lmintmate closed 5 years ago

lmintmate commented 5 years ago

I found your plugin through r/vim and decided to try it out, because I tend to modify my dotfiles and not commit the changes until I'm certain that this is the way I want them. Since I read in the r/vim thread that it could work without lightline, I installed it, but got the following error:

Error detected when processing BufEnter Autocommands for "*":
E117: Unknown function: lightline#update

I saw that this function was used in plugin/lightline/gitdiff.vim, in lines 8 and 10 specifically. When I manually removed the offending parts (that is | :call lightline#update(), the plugin worked then fine. Of course my solution is provisional and will break the plugin for lightline users, so perhaps a way to detect whether the user uses lightline or not, and avoid using the lightline#update function in case lightline isn't installed could solve the issue in a better manner. Vim version: 8.1. 1-1099. Host OS: Linux Mint Mate 18.3 Thanks a lot for creating this plugin and thanks in advance for your understanding.

niklaas commented 5 years ago

Thanks for filing an issue. :-) You're totally right. There's no need for calling lightline#update() if the plugin is not used in context of lightline.

This should be easy to fix and I'll do so as soon as possible. (At the moment I am working on a solution to show added, deleted and modified lines but I'll prioritize this issue.)

niklaas commented 5 years ago

@lmintmate can you check whether the problem persists when you use branch fix/no-update-for-non-lightline ?

lmintmate commented 5 years ago

Just checked (vim-plug's option to use plugins manually from a folder e.g. ~/lightline-gitdiff-fix-no-update-for-non-lightline is super convenient) and it doesn't throw any errors now.

niklaas commented 5 years ago

Great news! I'll merge the fix into master.

You can also specify a specific branch when declaring the plugin:

" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }