[vim/vim] Vim9 script compilation error when compiled with -clipboard and without GUI (Issue #19160)

0 views
Skip to first unread message

Coacher

unread,
Jan 11, 2026, 6:17:00 PM (8 hours ago) Jan 11
to vim/vim, Subscribed
Coacher created an issue (vim/vim#19160)

Steps to reproduce

  1. Create test.vim as shown below
  2. Run vim --clean -u test.vim via Vim with -clipboard and without GUI
  3. Observe compilation error on start

test.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()

Expected behaviour

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.

Version of Vim

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 09 2026 00:00:00) Included patches: 1-2068

Environment

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

Logs and stack traces

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.Message ID: <vim/vim/issues/19160@github.com>

Coacher

unread,
Jan 11, 2026, 6:19:59 PM (8 hours ago) Jan 11
to vim/vim, Subscribed
Coacher left a comment (vim/vim#19160)

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.Message ID: <vim/vim/issues/19160/3736294053@github.com>

Reply all
Reply to author
Forward
0 new messages