reload syntax file without restarting vim

476 views
Skip to first unread message

cyboman

unread,
Sep 9, 2011, 4:26:56 PM9/9/11
to vim_use
sometimes i need to make modifications to the syntax file but in order
for changes to take effect i need to restart vim. is it possible for
changes to take effect without a restart? does anybody know how to do
it?

any help is appreciated

Tony Mechelynck

unread,
Sep 9, 2011, 4:55:54 PM9/9/11
to vim...@googlegroups.com, cyboman

Depending on exactly what you want to do, one of the following should work:

:syntax enable

:syntax on

:syntax off | syntax on

see :help :syn-qstart


Best regards,
Tony.
--
You will lose your present job and have to become a door to door
mayonnaise salesman.

Ben Fritz

unread,
Sep 9, 2011, 7:51:19 PM9/9/11
to vim_use


On Sep 9, 3:55 pm, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:
> On 09/09/11 22:26, cyboman wrote:
>
> > sometimes i need to make modifications to the syntax file but in order
> > for changes to take effect i need to restart vim. is it possible for
> > changes to take effect without a restart? does anybody know how to do
> > it?
>
> > any help is appreciated
>
> Depending on exactly what you want to do, one of the following should work:
>
>         :syntax enable
>
>         :syntax on
>
>         :syntax off | syntax on
>
> see :help :syn-qstart
>

I'm also fond of:

:doautocmd Syntax

Andy Wokula

unread,
Sep 10, 2011, 5:43:13 AM9/10/11
to vim...@googlegroups.com

Should be quite simple:
Either reload the file

:e

or explicitly set the syntax (given your filetype is named "gobo")

:set syn=gobo

Doesn't that work? Or do it even "more manually":

:syn clear
:source {somepath}/syntax/gobo.vim

The latter requires that all syntax definitions are in one file.

If you're editing {somepath}/after/syntax/gobo.vim then at least two
files need to be sourced (the original and the "after" syntax file):

:syn clear
:runtime! syntax/gobo.vim

Hint: The :runtime command doesn't complain if it can't find any files.
Try :verb runtime! syntax/gobo.vim to get a message in that case.

In the help:

:h 'syn
:h :syn-clear
:h after
...

--
Andy

Reply all
Reply to author
Forward
0 new messages