aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Prager <splinterofchaos@gmail.com>2015-04-09 11:14:22 -0400
committerScott Prager <splinterofchaos@gmail.com>2015-04-09 11:14:22 -0400
commit4a7364c807a5ff03e7e4fd94549bc64a00f6ea99 (patch)
tree0a40a1766194763d035e7afdfd74a172349e0d08 /src
parentbae1da3f74ec91b8a79c764aa0277d96c932b2aa (diff)
parentcd7b910e8144dcc6092c7b1e1bfdc3193fdd643b (diff)
downloadrneovim-4a7364c807a5ff03e7e4fd94549bc64a00f6ea99.tar.gz
rneovim-4a7364c807a5ff03e7e4fd94549bc64a00f6ea99.tar.bz2
rneovim-4a7364c807a5ff03e7e4fd94549bc64a00f6ea99.zip
Merge pull request #2374 from mhinz/hl-group-termcursor
[RDY] Add new highlight groups TermCursor and TermCursorNC
Diffstat (limited to 'src')
-rw-r--r--src/nvim/globals.h12
-rw-r--r--src/nvim/option.c15
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--src/nvim/terminal.c39
4 files changed, 18 insertions, 50 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index d7087ee928..76ddd693a8 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -404,7 +404,9 @@ EXTERN int no_check_timestamps INIT(= 0); /* Don't check timestamps */
typedef enum {
HLF_8 = 0 /* Meta & special keys listed with ":map", text that is
displayed different from what it is */
- , HLF_EOB // after the last line in the buffer
+ , HLF_EOB //< after the last line in the buffer
+ , HLF_TERM //< terminal cursor focused
+ , HLF_TERMNC //< terminal cursor unfocused
, HLF_AT /* @ characters at end of screen, characters that
don't really exist in the text */
, HLF_D /* directories in CTRL-D listing */
@@ -451,10 +453,10 @@ typedef enum {
/* The HL_FLAGS must be in the same order as the HLF_ enums!
* When changing this also adjust the default for 'highlight'. */
-#define HL_FLAGS {'8', '~', '@', 'd', 'e', 'i', 'l', 'm', 'M', 'n', 'N', 'r', \
- 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', 'f', 'F', 'A', 'C', \
- 'D', 'T', '-', '>', 'B', 'P', 'R', 'L', '+', '=', 'x', 'X', \
- '*', '#', '_', '!', '.', 'o'}
+#define HL_FLAGS {'8', '~', 'z', 'Z', '@', 'd', 'e', 'i', 'l', 'm', 'M', 'n', \
+ 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', 'f', 'F', \
+ 'A', 'C', 'D', 'T', '-', '>', 'B', 'P', 'R', 'L', '+', '=', \
+ 'x', 'X', '*', '#', '_', '!', '.', 'o'}
EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */
EXTERN int highlight_user[9]; /* User[1-9] attributes */
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 929b96a3f8..7e5410ff63 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -363,13 +363,14 @@ typedef struct vimoption {
# define ISP_LATIN1 (char_u *)"@,161-255"
#define HIGHLIGHT_INIT \
- "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch," \
- "l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine," \
- "S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg," \
- "W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete," \
- "T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare," \
- "L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine," \
- "#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn"
+ "8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText," \
+ "d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr," \
+ "N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title," \
+ "v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn," \
+ "A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal," \
+ "B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel," \
+ "x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill," \
+ "!:CursorColumn,.:CursorLine,o:ColorColumn"
/*
* options[] is initialized here.
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 20bfbc8db4..c58c5fe897 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5785,6 +5785,8 @@ static char *(highlight_init_both[]) =
"TabLineSel term=bold cterm=bold gui=bold"),
CENT("TabLineFill term=reverse cterm=reverse",
"TabLineFill term=reverse cterm=reverse gui=reverse"),
+ CENT("TermCursor cterm=reverse",
+ "TermCursor cterm=reverse gui=reverse"),
NULL
};
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 2149f0f998..4007dfb04d 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -130,8 +130,6 @@ struct terminal {
// the default values are used to obtain the color numbers passed to cterm
// colors
RgbValue colors[256];
- // attributes for focused/unfocused cursor cells
- int focused_cursor_attr_id, unfocused_cursor_attr_id;
};
static VTermScreenCallbacks vterm_screen_callbacks = {
@@ -260,41 +258,6 @@ Terminal *terminal_open(TerminalOptions opts)
}
}
- // Configure cursor highlighting when focused/unfocused
- char *group = get_config_string(rv, "terminal_focused_cursor_highlight");
- if (group) {
- int group_id = syn_name2id((uint8_t *)group);
- free(group);
-
- if (group_id) {
- rv->focused_cursor_attr_id = syn_id2attr(group_id);
- }
- }
- if (!rv->focused_cursor_attr_id) {
- rv->focused_cursor_attr_id = get_attr_entry(&(attrentry_T) {
- .rgb_ae_attr = HL_INVERSE, .rgb_fg_color = -1, .rgb_bg_color = -1,
- .cterm_ae_attr = HL_INVERSE, .cterm_fg_color = 0, .cterm_bg_color = 0
- });
- }
-
- group = get_config_string(rv, "terminal_unfocused_cursor_highlight");
- if (group) {
- int group_id = syn_name2id((uint8_t *)group);
- free(group);
-
- if (group_id) {
- rv->unfocused_cursor_attr_id = syn_id2attr(group_id);
- }
- }
- if (!rv->unfocused_cursor_attr_id) {
- int yellow_rgb = RGB(0xfc, 0xe9, 0x4f);
- int yellow_term = 12;
- rv->unfocused_cursor_attr_id = get_attr_entry(&(attrentry_T) {
- .rgb_ae_attr = 0, .rgb_fg_color = -1, .rgb_bg_color = yellow_rgb,
- .cterm_ae_attr = 0, .cterm_fg_color = 0, .cterm_bg_color = yellow_term,
- });
- }
-
return rv;
}
@@ -555,7 +518,7 @@ void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr,
if (term->cursor.visible && term->cursor.row == row
&& term->cursor.col == col) {
attr_id = hl_combine_attr(attr_id, is_focused(term) && wp == curwin ?
- term->focused_cursor_attr_id : term->unfocused_cursor_attr_id);
+ hl_attr(HLF_TERM) : hl_attr(HLF_TERMNC));
}
term_attrs[col] = attr_id;