John Jackson
unread,Jun 1, 2026, 12:23:18 PM (yesterday) Jun 1Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Vim mailing list
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