highlight_defs.h
Go to the documentation of this file.
1 #ifndef NVIM_HIGHLIGHT_DEFS_H
2 #define NVIM_HIGHLIGHT_DEFS_H
3 
4 #include <inttypes.h>
5 
6 #include "nvim/macros.h"
7 #include "nvim/types.h"
8 
9 typedef int32_t RgbValue;
10 
14 typedef enum {
15  HL_INVERSE = 0x01,
16  HL_BOLD = 0x02,
17  HL_ITALIC = 0x04,
18  HL_UNDERLINE = 0x08,
19  HL_UNDERCURL = 0x10,
20  HL_STANDOUT = 0x20,
22  HL_NOCOMBINE = 0x80,
23  HL_BG_INDEXED = 0x0100,
24  HL_FG_INDEXED = 0x0200,
25  HL_DEFAULT = 0x0400,
26  HL_GLOBAL = 0x0800,
27  HL_UNDERLINELINE = 0x1000,
28  HL_UNDERDOT = 0x2000,
29  HL_UNDERDASH = 0x4000,
31 } HlAttrFlags;
32 
35 typedef struct attr_entry {
39  int hl_blend;
40 } HlAttrs;
41 
42 #define HLATTRS_INIT (HlAttrs) { \
43  .rgb_ae_attr = 0, \
44  .cterm_ae_attr = 0, \
45  .rgb_fg_color = -1, \
46  .rgb_bg_color = -1, \
47  .rgb_sp_color = -1, \
48  .cterm_fg_color = 0, \
49  .cterm_bg_color = 0, \
50  .hl_blend = -1, \
51 }
52 
55 typedef enum {
56  HLF_8 = 0, // Meta & special keys listed with ":map", text that is
57  // displayed different from what it is
58  HLF_EOB, // after the last line in the buffer
59  HLF_TERM, // terminal cursor focused
60  HLF_TERMNC, // terminal cursor unfocused
61  HLF_AT, // @ characters at end of screen, characters that don't really exist in the text
62  HLF_D, // directories in CTRL-D listing
63  HLF_E, // error messages
64  HLF_I, // incremental search
65  HLF_L, // last search string
66  HLF_LC, // current search match
67  HLF_M, // "--More--" message
68  HLF_CM, // Mode (e.g., "-- INSERT --")
69  HLF_N, // line number for ":number" and ":#" commands
70  HLF_LNA, // LineNrAbove
71  HLF_LNB, // LineNrBelow
72  HLF_CLN, // current line number when 'cursorline' is set
73  HLF_CLS, // current line sign column
74  HLF_CLF, // current line fold
75  HLF_R, // return to continue message and yes/no questions
76  HLF_S, // status lines
77  HLF_SNC, // status lines of not-current windows
78  HLF_C, // window split separators
79  HLF_VSP, // VertSplit
80  HLF_T, // Titles for output from ":set all", ":autocmd" etc.
81  HLF_V, // Visual mode
82  HLF_VNC, // Visual mode, autoselecting and not clipboard owner
83  HLF_W, // warning messages
84  HLF_WM, // Wildmenu highlight
85  HLF_FL, // Folded line
86  HLF_FC, // Fold column
87  HLF_ADD, // Added diff line
88  HLF_CHD, // Changed diff line
89  HLF_DED, // Deleted diff line
90  HLF_TXD, // Text Changed in diff line
91  HLF_SC, // Sign column
92  HLF_CONCEAL, // Concealed text
93  HLF_SPB, // SpellBad
94  HLF_SPC, // SpellCap
95  HLF_SPR, // SpellRare
96  HLF_SPL, // SpellLocal
97  HLF_PNI, // popup menu normal item
98  HLF_PSI, // popup menu selected item
99  HLF_PSB, // popup menu scrollbar
100  HLF_PST, // popup menu scrollbar thumb
101  HLF_TP, // tabpage line
102  HLF_TPS, // tabpage line selected
103  HLF_TPF, // tabpage line filler
104  HLF_CUC, // 'cursorcolumn'
105  HLF_CUL, // 'cursorline'
106  HLF_MC, // 'colorcolumn'
107  HLF_QFL, // selected quickfix line
108  HLF_0, // Whitespace
109  HLF_INACTIVE, // NormalNC: Normal text in non-current windows
110  HLF_MSGSEP, // message separator line
111  HLF_NFLOAT, // Floating window
112  HLF_MSG, // Message area
113  HLF_BORDER, // Floating window border
114  HLF_COUNT, // MUST be the last one
115 } hlf_T;
116 
117 EXTERN const char *hlf_names[] INIT(= {
118  [HLF_8] = "SpecialKey",
119  [HLF_EOB] = "EndOfBuffer",
120  [HLF_TERM] = "TermCursor",
121  [HLF_TERMNC] = "TermCursorNC",
122  [HLF_AT] = "NonText",
123  [HLF_D] = "Directory",
124  [HLF_E] = "ErrorMsg",
125  [HLF_I] = "IncSearch",
126  [HLF_L] = "Search",
127  [HLF_LC] = "CurSearch",
128  [HLF_M] = "MoreMsg",
129  [HLF_CM] = "ModeMsg",
130  [HLF_N] = "LineNr",
131  [HLF_LNA] = "LineNrAbove",
132  [HLF_LNB] = "LineNrBelow",
133  [HLF_CLN] = "CursorLineNr",
134  [HLF_CLS] = "CursorLineSign",
135  [HLF_CLF] = "CursorLineFold",
136  [HLF_R] = "Question",
137  [HLF_S] = "StatusLine",
138  [HLF_SNC] = "StatusLineNC",
139  [HLF_C] = "WinSeparator",
140  [HLF_T] = "Title",
141  [HLF_V] = "Visual",
142  [HLF_VNC] = "VisualNC",
143  [HLF_VSP] = "VertSplit",
144  [HLF_W] = "WarningMsg",
145  [HLF_WM] = "WildMenu",
146  [HLF_FL] = "Folded",
147  [HLF_FC] = "FoldColumn",
148  [HLF_ADD] = "DiffAdd",
149  [HLF_CHD] = "DiffChange",
150  [HLF_DED] = "DiffDelete",
151  [HLF_TXD] = "DiffText",
152  [HLF_SC] = "SignColumn",
153  [HLF_CONCEAL] = "Conceal",
154  [HLF_SPB] = "SpellBad",
155  [HLF_SPC] = "SpellCap",
156  [HLF_SPR] = "SpellRare",
157  [HLF_SPL] = "SpellLocal",
158  [HLF_PNI] = "Pmenu",
159  [HLF_PSI] = "PmenuSel",
160  [HLF_PSB] = "PmenuSbar",
161  [HLF_PST] = "PmenuThumb",
162  [HLF_TP] = "TabLine",
163  [HLF_TPS] = "TabLineSel",
164  [HLF_TPF] = "TabLineFill",
165  [HLF_CUC] = "CursorColumn",
166  [HLF_CUL] = "CursorLine",
167  [HLF_MC] = "ColorColumn",
168  [HLF_QFL] = "QuickFixLine",
169  [HLF_0] = "Whitespace",
170  [HLF_INACTIVE] = "NormalNC",
171  [HLF_MSGSEP] = "MsgSeparator",
172  [HLF_NFLOAT] = "NormalFloat",
173  [HLF_MSG] = "MsgArea",
174  [HLF_BORDER] = "FloatBorder",
175 });
176 
177 
178 EXTERN int highlight_attr[HLF_COUNT]; // Highl. attr for each context.
179 EXTERN int highlight_attr_last[HLF_COUNT]; // copy for detecting changed groups
180 EXTERN int highlight_user[9]; // User[1-9] attributes
181 EXTERN int highlight_stlnc[9]; // On top of user
182 EXTERN int cterm_normal_fg_color INIT(= 0);
183 EXTERN int cterm_normal_bg_color INIT(= 0);
184 EXTERN RgbValue normal_fg INIT(= -1);
185 EXTERN RgbValue normal_bg INIT(= -1);
186 EXTERN RgbValue normal_sp INIT(= -1);
187 
188 typedef enum {
196 } HlKind;
197 
198 typedef struct {
201  int id1;
202  int id2;
203  int winid;
204 } HlEntry;
205 
206 typedef struct {
207  int ns_id;
208  int syn_id;
209 } ColorKey;
210 #define ColorKey(n, s) (ColorKey) { .ns_id = (int)(n), .syn_id = (s) }
211 
212 typedef struct {
213  int attr_id;
214  int link_id;
215  int version;
217 } ColorItem;
218 #define COLOR_ITEM_INITIALIZER { .attr_id = -1, .link_id = -1, \
219  .version = -1, .is_default = false }
220 
221 
222 #endif // NVIM_HIGHLIGHT_DEFS_H
HLF_QFL
@ HLF_QFL
Definition: highlight_defs.h:107
HLF_CLF
@ HLF_CLF
Definition: highlight_defs.h:74
HLF_PSI
@ HLF_PSI
Definition: highlight_defs.h:98
HlEntry::kind
HlKind kind
Definition: highlight_defs.h:200
attr_entry
Definition: highlight_defs.h:35
ColorKey
#define ColorKey(n, s)
Definition: highlight_defs.h:210
HL_NOCOMBINE
@ HL_NOCOMBINE
Definition: highlight_defs.h:22
HLF_LNB
@ HLF_LNB
Definition: highlight_defs.h:71
HL_UNDERDASH
@ HL_UNDERDASH
Definition: highlight_defs.h:29
HLF_TERM
@ HLF_TERM
Definition: highlight_defs.h:59
HlEntry
Definition: highlight_defs.h:198
HLF_BORDER
@ HLF_BORDER
Definition: highlight_defs.h:113
HL_UNDERDOT
@ HL_UNDERDOT
Definition: highlight_defs.h:28
HLF_I
@ HLF_I
Definition: highlight_defs.h:64
HLF_PSB
@ HLF_PSB
Definition: highlight_defs.h:99
kHlSyntax
@ kHlSyntax
Definition: highlight_defs.h:191
attr_entry::hl_blend
int hl_blend
Definition: highlight_defs.h:39
HLF_CLN
@ HLF_CLN
Definition: highlight_defs.h:72
types.h
HlKind
HlKind
Definition: highlight_defs.h:188
HL_INVERSE
@ HL_INVERSE
Definition: highlight_defs.h:15
HLF_CUC
@ HLF_CUC
Definition: highlight_defs.h:104
HlEntry::winid
int winid
Definition: highlight_defs.h:203
HLF_FL
@ HLF_FL
Definition: highlight_defs.h:85
HLF_NFLOAT
@ HLF_NFLOAT
Definition: highlight_defs.h:111
HLF_SPL
@ HLF_SPL
Definition: highlight_defs.h:96
HLF_WM
@ HLF_WM
Definition: highlight_defs.h:84
INIT
const EXTERN char *hlf_names[] INIT(={[HLF_8]="SpecialKey", [HLF_EOB]="EndOfBuffer", [HLF_TERM]="TermCursor", [HLF_TERMNC]="TermCursorNC", [HLF_AT]="NonText", [HLF_D]="Directory", [HLF_E]="ErrorMsg", [HLF_I]="IncSearch", [HLF_L]="Search", [HLF_LC]="CurSearch", [HLF_M]="MoreMsg", [HLF_CM]="ModeMsg", [HLF_N]="LineNr", [HLF_LNA]="LineNrAbove", [HLF_LNB]="LineNrBelow", [HLF_CLN]="CursorLineNr", [HLF_CLS]="CursorLineSign", [HLF_CLF]="CursorLineFold", [HLF_R]="Question", [HLF_S]="StatusLine", [HLF_SNC]="StatusLineNC", [HLF_C]="WinSeparator", [HLF_T]="Title", [HLF_V]="Visual", [HLF_VNC]="VisualNC", [HLF_VSP]="VertSplit", [HLF_W]="WarningMsg", [HLF_WM]="WildMenu", [HLF_FL]="Folded", [HLF_FC]="FoldColumn", [HLF_ADD]="DiffAdd", [HLF_CHD]="DiffChange", [HLF_DED]="DiffDelete", [HLF_TXD]="DiffText", [HLF_SC]="SignColumn", [HLF_CONCEAL]="Conceal", [HLF_SPB]="SpellBad", [HLF_SPC]="SpellCap", [HLF_SPR]="SpellRare", [HLF_SPL]="SpellLocal", [HLF_PNI]="Pmenu", [HLF_PSI]="PmenuSel", [HLF_PSB]="PmenuSbar", [HLF_PST]="PmenuThumb", [HLF_TP]="TabLine", [HLF_TPS]="TabLineSel", [HLF_TPF]="TabLineFill", [HLF_CUC]="CursorColumn", [HLF_CUL]="CursorLine", [HLF_MC]="ColorColumn", [HLF_QFL]="QuickFixLine", [HLF_0]="Whitespace", [HLF_INACTIVE]="NormalNC", [HLF_MSGSEP]="MsgSeparator", [HLF_NFLOAT]="NormalFloat", [HLF_MSG]="MsgArea", [HLF_BORDER]="FloatBorder", })
HLF_E
@ HLF_E
Definition: highlight_defs.h:63
kHlUI
@ kHlUI
Definition: highlight_defs.h:190
HLF_MSGSEP
@ HLF_MSGSEP
Definition: highlight_defs.h:110
HLF_SNC
@ HLF_SNC
Definition: highlight_defs.h:77
highlight_attr_last
EXTERN int highlight_attr_last[HLF_COUNT]
Definition: highlight_defs.h:179
macros.h
HlAttrs
struct attr_entry HlAttrs
HLF_TP
@ HLF_TP
Definition: highlight_defs.h:101
HLF_PST
@ HLF_PST
Definition: highlight_defs.h:100
attr_entry::rgb_fg_color
RgbValue rgb_fg_color
Definition: highlight_defs.h:37
HLF_C
@ HLF_C
Definition: highlight_defs.h:78
HLF_TPF
@ HLF_TPF
Definition: highlight_defs.h:103
attr_entry::rgb_bg_color
RgbValue rgb_bg_color
Definition: highlight_defs.h:37
HLF_T
@ HLF_T
Definition: highlight_defs.h:80
HLF_LNA
@ HLF_LNA
Definition: highlight_defs.h:70
HLF_VSP
@ HLF_VSP
Definition: highlight_defs.h:79
HLF_SC
@ HLF_SC
Definition: highlight_defs.h:91
HLF_CLS
@ HLF_CLS
Definition: highlight_defs.h:73
kHlBlendThrough
@ kHlBlendThrough
Definition: highlight_defs.h:195
HLF_MSG
@ HLF_MSG
Definition: highlight_defs.h:112
HLF_CHD
@ HLF_CHD
Definition: highlight_defs.h:88
ColorItem::version
int version
Definition: highlight_defs.h:215
HL_STANDOUT
@ HL_STANDOUT
Definition: highlight_defs.h:20
HL_DEFAULT
@ HL_DEFAULT
Definition: highlight_defs.h:25
HL_UNDERLINE
@ HL_UNDERLINE
Definition: highlight_defs.h:18
HlEntry::id1
int id1
Definition: highlight_defs.h:201
HL_FG_INDEXED
@ HL_FG_INDEXED
Definition: highlight_defs.h:24
kHlBlend
@ kHlBlend
Definition: highlight_defs.h:194
HLF_EOB
@ HLF_EOB
Definition: highlight_defs.h:58
attr_entry::cterm_ae_attr
int16_t cterm_ae_attr
HlAttrFlags.
Definition: highlight_defs.h:36
HL_BOLD
@ HL_BOLD
Definition: highlight_defs.h:16
HLF_W
@ HLF_W
Definition: highlight_defs.h:83
ColorItem::link_id
int link_id
Definition: highlight_defs.h:214
highlight_user
EXTERN int highlight_user[9]
Definition: highlight_defs.h:180
kHlUnknown
@ kHlUnknown
Definition: highlight_defs.h:189
HlEntry::attr
HlAttrs attr
Definition: highlight_defs.h:199
HL_UNDERCURL
@ HL_UNDERCURL
Definition: highlight_defs.h:19
HlAttrFlags
HlAttrFlags
Definition: highlight_defs.h:14
HLF_CONCEAL
@ HLF_CONCEAL
Definition: highlight_defs.h:92
attr_entry::rgb_sp_color
RgbValue rgb_sp_color
Definition: highlight_defs.h:37
ColorKey::ns_id
int ns_id
Definition: highlight_defs.h:207
HLF_FC
@ HLF_FC
Definition: highlight_defs.h:86
HLF_CM
@ HLF_CM
Definition: highlight_defs.h:68
HLF_AT
@ HLF_AT
Definition: highlight_defs.h:61
attr_entry::cterm_fg_color
int cterm_fg_color
Definition: highlight_defs.h:38
HLF_ADD
@ HLF_ADD
Definition: highlight_defs.h:87
HLF_8
@ HLF_8
Definition: highlight_defs.h:56
HLF_SPC
@ HLF_SPC
Definition: highlight_defs.h:94
HLF_L
@ HLF_L
Definition: highlight_defs.h:65
EXTERN
#define EXTERN
Definition: macros.h:9
HLF_INACTIVE
@ HLF_INACTIVE
Definition: highlight_defs.h:109
HL_GLOBAL
@ HL_GLOBAL
Definition: highlight_defs.h:26
HLF_TERMNC
@ HLF_TERMNC
Definition: highlight_defs.h:60
highlight_stlnc
EXTERN int highlight_stlnc[9]
Definition: highlight_defs.h:181
attr_entry::cterm_bg_color
int cterm_bg_color
Definition: highlight_defs.h:38
HL_UNDERLINELINE
@ HL_UNDERLINELINE
Definition: highlight_defs.h:27
ColorKey::syn_id
int syn_id
Definition: highlight_defs.h:208
attr_entry::rgb_ae_attr
int16_t rgb_ae_attr
Definition: highlight_defs.h:36
HL_BG_INDEXED
@ HL_BG_INDEXED
Definition: highlight_defs.h:23
kHlCombine
@ kHlCombine
Definition: highlight_defs.h:193
HLF_TPS
@ HLF_TPS
Definition: highlight_defs.h:102
HLF_M
@ HLF_M
Definition: highlight_defs.h:67
ColorItem::attr_id
int attr_id
Definition: highlight_defs.h:213
ColorItem::is_default
bool is_default
Definition: highlight_defs.h:216
HLF_S
@ HLF_S
Definition: highlight_defs.h:76
HLF_DED
@ HLF_DED
Definition: highlight_defs.h:89
ColorItem
Definition: highlight_defs.h:212
HLF_SPB
@ HLF_SPB
Definition: highlight_defs.h:93
RgbValue
int32_t RgbValue
Definition: highlight_defs.h:9
HLF_D
@ HLF_D
Definition: highlight_defs.h:62
HLF_CUL
@ HLF_CUL
Definition: highlight_defs.h:105
HLF_0
@ HLF_0
Definition: highlight_defs.h:108
HLF_SPR
@ HLF_SPR
Definition: highlight_defs.h:95
HLF_PNI
@ HLF_PNI
Definition: highlight_defs.h:97
HlEntry::id2
int id2
Definition: highlight_defs.h:202
HL_ANY_UNDERLINE
@ HL_ANY_UNDERLINE
Definition: highlight_defs.h:30
HLF_V
@ HLF_V
Definition: highlight_defs.h:81
HLF_COUNT
@ HLF_COUNT
Definition: highlight_defs.h:114
highlight_attr
EXTERN int highlight_attr[HLF_COUNT]
Definition: highlight_defs.h:178
HLF_N
@ HLF_N
Definition: highlight_defs.h:69
HL_STRIKETHROUGH
@ HL_STRIKETHROUGH
Definition: highlight_defs.h:21
hlf_T
hlf_T
Definition: highlight_defs.h:55
HLF_R
@ HLF_R
Definition: highlight_defs.h:75
HLF_LC
@ HLF_LC
Definition: highlight_defs.h:66
HLF_MC
@ HLF_MC
Definition: highlight_defs.h:106
HL_ITALIC
@ HL_ITALIC
Definition: highlight_defs.h:17
HLF_TXD
@ HLF_TXD
Definition: highlight_defs.h:90
kHlTerminal
@ kHlTerminal
Definition: highlight_defs.h:192
HLF_VNC
@ HLF_VNC
Definition: highlight_defs.h:82