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