test.vim as shown belowvim --clean -u test.vim via Vim with -clipboard and without GUItest.vim:
vim9script
export var register: string
export def StoreClipboardName()
if !has('clipboard')
register = ''
else
var names = split(&clipboard, ',')
if index(names, 'unnamedplus') >= 0
register = '+'
elseif index(names, 'unnamed') >= 0
register = '*'
else
register = ''
endif
endif
enddef
autocmd VimEnter * StoreClipboardName()
There is no compilation error, because the code is valid.
This behavior is observed when running vim --clean -u test.vim via Vim with +clipboard and with GUI, e.g. vimx.
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 09 2026 00:00:00) Included patches: 1-2068
Operating System: Fedora Linux 43
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.22.0
Qt Version: 6.10.1
Kernel Version: 6.18.4-200.fc43.x86_64 (64-bit)
Graphics Platform: Wayland
Terminal: Konsole-25.12.1
$TERM: xterm-256color
Shell: bash 5.3.0(1)-release
vim --version where error is seen: VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 09 2026 00:00:00) Included patches: 1-2068 Modified by <bugz...@redhat.com> Compiled by <bugz...@redhat.com> Huge version without GUI. Features included (+) or not (-): +acl +arabic +autocmd +autochdir -autoservername -balloon_eval +balloon_eval_term -browse ++builtin_terms +byte_offset +channel +cindent +clientserver -clipboard +clipboard_provider +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +ipv6 +job +jumplist +keymap +lambda +langmap +libcall +linebreak +lispindent +listcmds +localmap +lua/dyn +menu +mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg +num64 +packages +path_extra +perl/dyn +persistent_undo +popupwin +postscript +printer +profile -python +python3/dyn-stable +quickfix +reltime +rightleft +ruby/dyn +scrollbind +signs +smartindent +socketserver +sodium -sound +spell +startuptime +statusline -sun_workshop +syntax +tabpanel +tag_binary -tag_old_static -tag_any_white -tcl +termguicolors +terminal +terminfo +termresponse +textobjects +textprop +timers +title -toolbar +user_commands +vartabs +vertsplit +vim9script +viminfo +virtualedit +visual +visualextra +vreplace -wayland -wayland_clipboard -wayland_focus_steal +wildignore +wildmenu +windows +writebackup -X11 +xattr -xfontset -xim -xpm -xsmp -xterm_clipboard -xterm_save system vimrc file: "/etc/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" 3rd user vimrc file: "~/.config/vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -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 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -std=c17 -DSYS_VIMRC_FILE=/etc/vimrc -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -Wl,--build-id=sha1 -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -L/usr/local/lib -o vim -lm -lselinux -lncurses -lsodium -lacl -lattr -lgpm
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Error:
Error detected while compiling VimEnter Autocommands for "*"..function <SNR>1_StoreClipboardName:
line 7:
E1001: Variable not found: names
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Seems to work fine for me, could you try the latest Vim version?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Seems to work fine for me, could you try the latest Vim version?
Yes, will try in a day or two.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
could not reproduce it either on latest master, but also saw this issue with some older Vim version. Let's assume this is fixed, so closing.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Seems to work fine for me, could you try the latest Vim version?
I have tested on ead1dda. The issue persists.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
could not reproduce it either on latest master, but also saw this issue with some older Vim version. Let's assume this is fixed, so closing.
This is not fixed here on ead1dda. Could you please reopen?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I've tested it a bit more. Here is a minimal example that works on any build:
vim9script
def TestFunction()
if !has('bugs')
echo 'No bugs'
else
var a_variable = 0
if a_variable > 0
echo 'Positive'
elseif a_variable < 0
echo 'Negative'
else
echo 'Zero'
endif
endif
enddef
defcompile
I've replaced check for 'clipboard' feature with an obviously missing feature. The issue then can be triggered on any build. I've also replaced all calls to other functions with simple echoes and assignments.
Surprisingly, replacing !has check with false allows to compile the function.
Also removing only elseif clause allows to compile the function.
Also saving the result of !has check to a variable before the outermost if clause allows to compile the function.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
looks a bit like this issue: #17750 ping @yegappan
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()