You are not logged in.

#1 2014-07-10 17:24:12

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

[vim syntax] Highlight all occurences of <word> following <keyword>

Is it possible with vim syntax files to have special highlighting for all occurrences of words (preferably excluding occurences in comments and quoted strings) following a keyword? Eg. in the case of declaring variables:

short <varname>

I'd like every occurrence of all variables declared as 'short' (preferably including the occurrence in the declaration) to be a specific color.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#2 2014-08-05 22:46:32

fungle
Member
Registered: 2014-05-01
Posts: 81

Re: [vim syntax] Highlight all occurences of <word> following <keyword>

You can do `short <varname>` and have that occurence of <varname> be highlighted but you can't have all occurences of <varname> be highlighted. Vim syntax only uses simple pattern matching so it can't determine dynamically what the pattern is after you declare it. Your next best option might be to set hlsearch and use the # and * and related operators.

Offline

Board footer

Powered by FluxBB