vim9 _vimrc compatibility with vim8 plugin

57 views
Skip to first unread message

N V

unread,
Jul 22, 2022, 4:54:33 AM7/22/22
to vim_use
Hi,

Encoutering this error as i attempt to use gutentag vim8 plugin and have $MYVIMRC in vim9script.

Error detected while processing foo:\barfoo\Vim\vimfiles\plugged\vim-gutentags\plugin\gutentags.vim:
line   44:
E745: Using a List as a Number
E16: Invalid range
" foo:\barfoo  \Vim\vimfiles\plugged\vim-gutentags\plugin\gutentags.vim" 120L, 4588B

--------------------------

In _vimrc I set a global var gutentags_add_default_project_roots in _vimrc vim9script that seems to have side effect to  vimfiles\plugged\vim-gutentags\plugin\gutentags.vim line 44.


any idea ?thanks NV

------------

Capture.PNG
Capture1.PNG

N V

unread,
Jul 22, 2022, 7:30:04 AM7/22/22
to vim_use
It's like when setting a global variable from _vim9rc, it affects vim8 script same global variable.

Bram Moolenaar

unread,
Jul 22, 2022, 3:54:57 PM7/22/22
to vim...@googlegroups.com, N V

> It's like when setting a global variable from _vim9rc, it *affects
> vim8 *script same global variable.

In Vim9 script variables are script-local by default, prefixing g: is
required to access global variables.

In legacy script variables are global by default, prefixing s: is
required to access script-local variables.


--
hundred-and-one symptoms of being an internet addict:
94. Now admit it... How many of you have made "modem noises" into
the phone just to see if it was possible? :-)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

N V

unread,
Jul 23, 2022, 8:38:04 AM7/23/22
to vim_use
Yes, taking into account these behaviors by default, it does not prevent that I note as an interference when I affect in my _vim9rc a global variable put in interface of the script legacy gutentags.  This global variable, actually a list of strings, in the legacy script is retrieved by a get(g:, nomVar) in a variable with the same name.  Then it is tested at line 44 of gutentags plugin that missunderstood the type. It seems that this worked in legacy script but as soon as it is assigned in a vim9 script like my _vim9rc it alters the initial operation.  While it shouldn't in the sense that a global remains a global whether swapped between a vim9 or a vim8 script legacy
Reply all
Reply to author
Forward
0 new messages