Reputation: 2478
In vim, I'd like to change a font color for just one line depending on if said line starts (with any preceding tab/space/whitespace) a dash, period, slash, or 'x'. How can I program/configure existing vim to do this?
Upvotes: 1
Views: 1325
Reputation: 172530
In Vim, a colorscheme just provides a mapping of highlighting groups (usually generic ones such as Comment
, String
, though particular syntaxes also define things like vimLineComment
) to foreground / background colors and text attributes such as bold or italic. What you want is a custom syntax definition.
:help usr_44.txt
introduces writing a syntax file; you can also look to the existing ones in $VIMRUNTIME/syntax/
for inspiration. To highlight lines starting with x
:
:syntax match mysyntaxXLine /^x.*$/
:highlight link mysyntaxXLine Error
Upvotes: 4