A question about autocommands

18 views
Skip to first unread message

Gabor Urban

unread,
Mar 13, 2025, 3:43:35 PMMar 13
to vim...@googlegroups.com
Hi guys,

I would like to have some hints about my issue.

I am using vim 9.1 on an MS Win 11 Home (64 bit). I have downloaded a
syntax file from the homage (todo.vim) and set up to work for me.

I added to my _vimr file:
au BufRead,BufNewFile *.todo setfiletype todo
au BufRead,BufNewFile *.tdx setfiletype todo

and that works fine. Recently I have decided to load a specific file
on startup so added:
autocmd VimEnter * silent edit C:/PATH/todo.tdx

The file is loaded, but no proper highlight is done. The only reason
could be, that the two autocommands do not work together.

Any ideas are welcome, and thanks in advance,
--
Urbán Gábor

Linux is like a wigwam: no Gates, no Windows and an Apache inside.

Christian Brabandt

unread,
Mar 13, 2025, 4:27:49 PMMar 13
to vim...@googlegroups.com

On Thu, 13 Mar 2025, Gabor Urban wrote:

> Hi guys,
>
> I would like to have some hints about my issue.
>
> I am using vim 9.1 on an MS Win 11 Home (64 bit). I have downloaded a
> syntax file from the homage (todo.vim) and set up to work for me.
>
> I added to my _vimr file:
> au BufRead,BufNewFile *.todo setfiletype todo
> au BufRead,BufNewFile *.tdx setfiletype todo
>
> and that works fine. Recently I have decided to load a specific file
> on startup so added:
> autocmd VimEnter * silent edit C:/PATH/todo.tdx
>
> The file is loaded, but no proper highlight is done. The only reason
> could be, that the two autocommands do not work together.
>
> Any ideas are welcome, and thanks in advance,

Try to add ++nested to your BufRead autocommand, see :h autocmd-nested

Thanks,
Christian
--
A star captain's most solemn oath is that he will give his life, even
his entire crew, rather than violate the Prime Directive.
-- Kirk, "The Omega Glory", stardate unknown
Reply all
Reply to author
Forward
0 new messages