vim-gina
vim-gina copied to clipboard
Statusline issue together with `Rykka/riv.vim`
I am currently using gina.vim to show the branch in vim-airline/vim-airline. There seems to be however a severe conflict with ReST files if I use Rykka/riv.vim.
I get the error message
Error detected while processing function gina#component#repo#branch[1]..gina#core#get[33]..<SNR>78_get_from_bufname[1]..<SNR>78_get_from_path:
line 2:
E716: Key not present in Dictionary: new(path)
The minimal init.vim is
let g:vimdir = expand('~').'/.config/nvim'
call plug#begin(g:vimdir.'/plugged')
Plug 'vim-airline/vim-airline'
Plug 'lambdalisue/gina.vim'
Plug 'Rykka/riv.vim'
call plug#end()
call airline#parts#define_function('gina', 'gina#component#repo#branch')
let g:airline_section_b = airline#section#create(['hunks', g:airline_symbols.branch,'gina'])
I am currently using NVIM v0.3.1-1-g489d32f2b, previously used NVIM v0.2.3-1-gd6f9d1df0 giving the same error.
Reproduced. I'll investigate.
" vim -u ~/.vim/vimrc.min
call plug#begin(expand('~/.config/nvim/plugged'))
Plug 'lambdalisue/gina.vim'
Plug 'Rykka/riv.vim'
call plug#end()
set statusline=%{gina#component#repo#branch()}
Workaround
@DerWeh I found a workaround. Call gina#core#get() prior to Rykka/riv.vim.
call plug#begin(expand('~/.config/nvim/plugged'))
Plug 'lambdalisue/gina.vim'
Plug 'Rykka/riv.vim'
call plug#end()
" Call 'gina#core#get()' (or anything) prior to 'Rykka/riv.vim'
call gina#core#get()
set statusline=%{gina#component#repo#branch()}
Investigation
Diff
diff --git a/autoload/gina/core.vim b/autoload/gina/core.vim
index 6097976..449034c 100644
--- a/autoload/gina/core.vim
+++ b/autoload/gina/core.vim
@@ -1,6 +1,9 @@
let s:Cache = vital#gina#import('System.Cache.Memory')
let s:Git = vital#gina#import('Git')
+echomsg 'System.Cachem.Memory: ' . string(s:Cache)
+echomsg 'Git: ' . string(s:Git)
+
let s:registry = s:Cache.new()
let s:reference = s:Cache.new()
Positive case (nvim -u ~/.vim/vimrc.min test.txt)
System.Cachem.Memory: {'new': function('<SNR>65_new')}
Git: {'resolve': function('<SNR>55_resolve'), 'ref': function('<SNR>55_ref'), 'abspath': function('<SNR>55_abspath'), 'relpath': function('<SNR>55_relpath'), 'new': function('<SNR>55_new')}
Negative case (nvim -u ~/.vim/vimrc.min test.rst)
Error detected while processing function gina#component#repo#branch[1]..gina#core#get[33]..<SNR>66_get_from_bufname[1]..<SNR>66_get_from_path:
line 2:
E716: Key not present in Dictionary: new(path)
Error detected while processing function gina#component#repo#branch[1]..gina#core#get[33]..<SNR>66_get_from_bufname[1]..<SNR>66_get_from_path:
line 2:
E15: Invalid expression: s:Git.new(path)
Note: It seems the result of echomsg added are not shown (:messages shows only above message). Because the code is called in statusline?