2

Yesterday I updated Vim to version 8.2 thru my Linux distro repositories (Fedora). And now I noticed that no user defined functions exist. They worked just yesterday, before the update.

I define several functions in my vimrc file. It used to work, but now it looks like definition rules have changed or something like that:

function! Foo()
  echo 'foo'
endfunction
echo exists('Foo')

This outputs 0.

This is the output of $: vim --version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Aug 16 2021 00:00:00)
Included patches: 1-3354
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl/dyn          +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
-clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +virtualedit
+cmdline_hist      +langmap           -python            +visual
+cmdline_info      +libcall           +python3/dyn       +visualextra
+comments          +linebreak         +quickfix          +viminfo
+conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          +rightleft         +wildignore
+cscope            +localmap          +ruby/dyn          +wildmenu
+cursorbind        +lua/dyn           +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con        +mksession         +smartindent       -X11
+diff              +modify_fname      +sodium            -xfontset
+digraphs          +mouse             -sound             -xim
-dnd               -mouseshape        +spell             -xpm
-ebcdic            +mouse_dec         +startuptime       -xsmp
+emacs_tags        +mouse_gpm         +statusline        -xterm_clipboard
+eval              -mouse_jsbterm     -sun_workshop      -xterm_save
+ex_extra          +mouse_netterm     +syntax            
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim82"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -L. -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -o vim -lm -lselinux -lncurses -lsodium -lacl -lattr -lgpm -ldl -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -L/usr/local/lib -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -ldl -lm -lcrypt -lutil -lc 

Could anyone, please, explain what happened?

3
  • 2
    Please don’t post images of text
    – D. Ben Knoble
    Aug 20, 2021 at 11:17
  • @D.BenKnoble on the other hand images have some benefits. They are rather precise (provided the resolution is sufficient), you cannot make a typo, they give a better context from where they came from. Aug 20, 2021 at 13:18
  • 2
    You can’t typo copy and paste either (for example, vim --version | pbcopy on a mac). They serve to illustrate graphical problems well, but for textual matters they are simply the wrong medium. I lay out a few reasons in my post: even good resolution does not combat some problems (for example, small screen of a phone). Not sure what context is relevant for the text that you would want an image in this case.
    – D. Ben Knoble
    Aug 20, 2021 at 13:21

2 Answers 2

3

There was a regression bug in 8.2.3337 and it was fixed yesterday.

3
  • I thought it was a plugin's fault. Since functions exist, if I start Vim thru vim --noplugin Aug 20, 2021 at 10:22
  • 1
    Plugins you use most probably have dict functions. I had the same issue, removing single plugin made it work, which was very confusing.
    – Maxim Kim
    Aug 20, 2021 at 10:32
  • I installed Vim 9 on several machines to get around this bug, but I am STILL getting warnings about unknown functions that work fine on other Ubuntu 22.04 machines. Clearly I'm doing something wrong, but I dunno what.
    – ivanlan
    Oct 28 at 20:15
2

To test whether a function exists, you should check *funcname (with a "star") prefix. So this will work:

:echo exists('*Foo')
1

Checking a name without the "star" prefix will actually check whether a variable by that name exists:

:let Bar = 99
:echo exists('Bar')
1

See :help exists().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.