Different syntax behavior in vim 7.4

17 views
Skip to first unread message

Chandra

unread,
Apr 5, 2017, 5:59:07 PM4/5/17
to vim_use
Hello,
I see a syntax behavior change between vim 7.4 and earlier version. (We are yet to update VIM version to 8.0+ in our company.)

I use different syntax for lines that begin with "//" (Comments) and lines that begin with "//:" (embedded Perl Code). I was able to achieve this with earlier version of vim by specifying this in the syntax file,

syn match embPerlCode "^\s*//:.*"

and this in .gvimrc,

highlight embPerlCode gui=bold guifg=maroon

This works fine in version 7.2 (didn't check in 7.3). But in version 7.4 the behavior has changed. The embPerlCode lines are shown with syntax color of Comments.

Is there a way to get around this and get back the previous behavior?

thanks,
Chandra

Dominique Pellé

unread,
Apr 5, 2017, 6:44:18 PM4/5/17
to Vim List
Using vim-8.0.543 (gtk3 gui), it works as expected for me
i.e. I see different colors for comments if I do:

$ vim -f -g \
-c 'syntax on' \
-c 'setfiletype cpp' \
-c 'syn match embPerlCode "^\s*//:.*"' \
-c 'hi embPerlCode gui=bold guifg=maroon' \
-c 'call setline(1, ["// a cpp comment", "//: an empPerlCode comment"])'

Can you double check?

If you use vim-7.2 or 7.3, you're missing a lot of
fixes and useful new features.

Dominique

Chandrasekaran Venkatraman

unread,
Apr 5, 2017, 10:31:26 PM4/5/17
to vim...@googlegroups.com
Yes, I could get the expected syntax display with vim 8.0 .

Thanks.


--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/bO4pbg3nvoU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages