Monday, June 1, 2026

Loading filetype scripts when editing a file on VimEnter

Hello Vim users, I want an installation of gVim to auto-edit a "notes" file when opened with no arguments. I'm using this script in my Vim configuration: vim9script def LoadNotes()   if argc() == 0     edit path\to\notes.md     echomsg "Auto-opened notes.md."   endif enddef autocmd VimEnter * ++once LoadNotes() This edits the file as expected. However, Vim does not apply syntax highlighting to the file. When I run :scriptnames, none of the Markdown ftplugin or syntax scripts are listed. (Although many other ftplugin script names are listed.) If I manually run :edit after startup, then the syntax highlighting works, and Vim's ftplugin\markdown.vim and its associated scripts are now all listed in :scriptnames. Is there a way to guarantee that Vim will load all of the needed filetype scripts during the VimEnter event? Or is there a more appropriate event for this use case? I'm happy to provide more details if they're helpful. :version VIM - Vi IMproved 9.2 (2026 Feb 14, compiled Feb 14 2026 12:17:29) MS-Windows 64-bit GUI/console version with OLE support John -- -- You received this message from the "vim_use" 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_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_use/0fde278a-c7b1-4e57-8016-03a673adaf1f%40icloud.com.