On 2021-01-12, Gary Johnson wrote: > The command-line completion for the :echo command does not find > functions whose names begin with g:. > > To demonstrate this, first start vim like this, > > $ vim -N -u NONE -i NONE > > then source a file containing the following. > > let FooVar = "foo" > let g:BarVar = "bar" > > function! FooFunc() > echo "foo" > endfunction > > function! g:BarFunc() > echo "bar" > endfunction > > Now, try completing each of those symbols after :echo with ^D > (Ctr-D). > > :echo g: > g:BarVar g:FooVar > :echo Bar > BarFunc() BarVar > :echo Foo > FooFunc() FooVar > > Note that the global variables are expanded following g: even if > they were not defined with g:, but that neither global function is > expanded following g: even if g: was in its name when defined. > > I know the problem can be worked around, but when I see a function > defined with g: in its name, I'd like to be able to echo its return > value by typing the first few characters of its name as I see them > without having to think very much about it, as I can with global > variables. > > I'm using vim 8.2.2340 in a terminal on an Ubuntu 20.04 system. > > The problem also exists with vim 8.1.497. This works differently on > 7.2.330, more as I would expect it to. > > :echo g: > g:BarFunc() g:BarVar g:FooVar > :echo Bar > BarVar > :echo Foo > FooFunc() FooVar > > I understand the desirability of expanding global symbols with or > without using the g: prefix, but I think including the g: prefix > should expand global function names as well as global variables. > > I have not performed a git bisect to find the offending commit.
I just did. A bug was introduced at v7.4.260 that prevented function names from beginning with g:. That was fixed at v7.4.264 but introduced the bug that prevents ":echo g:^D" from finding global functions. Regards, Gary -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20210113045221.GA30837%40phoenix.
