syntax coloring ignored in actions triggered by events

20 views
Skip to first unread message

Edward Peschko

unread,
May 30, 2019, 1:24:06 AM5/30/19
to vim_dev
All,

I'm hitting an odd bug when I define an event which involves splitting a window. I've isolated it down to the following example:

autocmd CursorMoved * :execute ":silent! split /perl/module/mymod.pm"

where mymod.pm is a valid perl module with valid perl syntax.

In any case I have syntax coloring enabled for perl modules, yet when it hits a CursorMoved event it splits the window displaying the code but NOT coloring the syntax. When I run

:hi

it shows all of the highlighting configurations so I'm pretty sure it has something to do with the event combined with the execute action. Running:

:syn on

after the CursorMoved event happens is ignored.

Anyways I'm running the latest 8.1 source - I tried it with a python module and a vimrc file and both hit the same issue.

if there is a vim bug repo let me know and I'll file an official bug.

thanks much,

Ed

(ps - one other bug - it looks like a split event triggered by CursorMoved at the very outset - right after the editor loads up - causes vim to freeze until an interrupt is given. )

Christian Brabandt

unread,
May 30, 2019, 2:33:35 AM5/30/19
to vim...@googlegroups.com
You probably need the nested keyword for your autocommand
> --
> --
> You received this message from the "vim_dev" 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_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/2da2485f-19c1-410c-b045-c723d386a109%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Edward Peschko

unread,
May 30, 2019, 11:22:56 AM5/30/19
to vim_dev
On Wednesday, May 29, 2019 at 11:33:35 PM UTC-7, Christian Brabandt wrote:
> You probably need the nested keyword for your autocommand
>
Christian -

I don't see any documentation on that keyword inside of vim. Not seeing much on the internet either.

Can you give an example and why it is needed - or am I missing something in the docs?

Thanks much,

Ed

Gary Johnson

unread,
May 30, 2019, 12:12:38 PM5/30/19
to vim_dev
:help autocmd-nested

You can find this by typing

:help nested

and hitting Ctrl-D to list help entries containing "nested". See
just

:help

You can also use :helpgrep to search the documentation for words or
patterns. For example,

:helpgrep :au.*nested

finds 10 matches, including an entry in the user manual in
usr_40.txt.

Regards,
Gary

Edward Peschko

unread,
May 30, 2019, 1:40:15 PM5/30/19
to vim_dev

> :help autocmd-nested
>
> You can find this by typing
>
> :help nested
>
> and hitting Ctrl-D to list help entries containing "nested". See
> just
>
> :help
>
> You can also use :helpgrep to search the documentation for words or
> patterns. For example,
>
> :helpgrep :au.*nested
>
> finds 10 matches, including an entry in the user manual in
> usr_40.txt.
>
> Regards,
> Gary

thanks Gary, I found it by doing grep -r of the vim source directory. Your methods are much cleaner though...

Ed

Christian Brabandt

unread,
May 30, 2019, 1:53:27 PM5/30/19
to vim_dev

On Do, 30 Mai 2019, Edward Peschko wrote:

> thanks Gary, I found it by doing grep -r of the vim source directory. Your methods are much cleaner though...

Sorry, I wasn't in front of my desktop PC when I wrote the answer, so
couldn't point to the right vim documentation. In addition, the nested
flag has just been recently switched from using the default keyword to
using the ++nested keyword, so depending on your vim version, it's a bit
different.


Best,
Christian
--
Konversation ist die Kunst zu reden, ohne zu denken.
-- Victor de Kowa
Reply all
Reply to author
Forward
0 new messages