-
Notifications
You must be signed in to change notification settings - Fork 168
Highlighting configuration
OmniSharp provides semantic classification of every symbol in a c# document. By default, OmniSharp-vim highlights most textual symbols, leaving language keywords and punctuation to be highlighted by Vim's standard regex-based highlighting system.
To modify OmniSharp-vim's defaults, create a g:OmniSharp_highlight_groups
dictionary. The highlight groups may either be existing groups, or custom groups defined by the user:
let g:OmniSharp_highlight_groups = {
\ 'Comment': 'NonText',
\ 'XmlDocCommentName': 'Identifier',
\ 'XmlDocCommentText': 'NonText'
\}
To find out the classification name of the symbol or character under the cursor, use the :OmniSharpHighlightEcho
command.
Below is the full list of available Roslyn classification type names, along with their default Vim highlight groups, as assigned by OmniSharp-vim
Name | Default highlight group |
---|---|
Comment | |
ExcludedCode | |
Identifier | Identifier |
Keyword | |
ControlKeyword | |
NumericLiteral | |
Operator | |
OperatorOverloaded | |
PreprocessorKeyword | |
StringLiteral | |
WhiteSpace | |
Text | |
StaticSymbol | Identifier |
PreprocessorText | |
Punctuation | |
VerbatimStringLiteral | |
StringEscapeCharacter | |
ClassName | Identifier |
DelegateName | Identifier |
EnumName | Identifier |
InterfaceName | Include |
ModuleName | |
StructName | Identifier |
TypeParameterName | Type |
FieldName | Identifier |
EnumMemberName | Identifier |
ConstantName | Identifier |
LocalName | Identifier |
ParameterName | Identifier |
MethodName | Function |
ExtensionMethodName | Function |
PropertyName | Identifier |
EventName | Identifier |
NamespaceName | Identifier |
LabelName | Label |
XmlDocCommentAttributeName | |
XmlDocCommentAttributeQuotes | |
XmlDocCommentAttributeValue | |
XmlDocCommentCDataSection | |
XmlDocCommentComment | |
XmlDocCommentDelimiter | |
XmlDocCommentEntityReference | |
XmlDocCommentName | |
XmlDocCommentProcessingInstruction | |
XmlDocCommentText | |
XmlLiteralAttributeName | |
XmlLiteralAttributeQuotes | |
XmlLiteralAttributeValue | |
XmlLiteralCDataSection | |
XmlLiteralComment | |
XmlLiteralDelimiter | |
XmlLiteralEmbeddedExpression | |
XmlLiteralEntityReference | |
XmlLiteralName | |
XmlLiteralProcessingInstruction | |
XmlLiteralText | |
RegexComment | |
RegexCharacterClass | |
RegexAnchor | |
RegexQuantifier | |
RegexGrouping | |
RegexAlternation | |
RegexText | |
RegexSelfEscapedCharacter | |
RegexOtherEscape |
When Vim 8.1 text properties or neovim namespaces are not available, or when using the HTTP server, limited semantic highlighting is still possible by highlighting keywords. Note that this is not perfect - a keyword can only match a single highlight group, meaning that interfaces/classes/methods/parameters with the same name will be highlighted the same as each other.
The configuration options are also more limited.
4 highlight groups are defined for highlighting most code elements: csUserIdentifier
, csUserInterface
, csUserMethod
and csUserType
.
These highlight groups are defined as follows:
highlight default link csUserIdentifier Identifier
highlight default link csUserInterface Include
highlight default link csUserMethod Function
highlight default link csUserType Type
To change a highlight group's colors, link it to another highlight group:
highlight link csUserType Identifier
Or define the group yourself:
highlight csUserInterface ctermfg=12 guifg=Blue
To disable a group, link it to Normal
:
highlight link csUserMethod Normal