aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2019-02-20 14:33:55 -0700
committerJosh Rahm <rahm@google.com>2021-10-05 02:21:59 -0600
commit2bd8a5e4b77367c29f3c9ed2091023dc69f35239 (patch)
treed2f3f9983849bdf5968a16e4d504d2ae1bb8acf0
parentba1e9454aacd27582d1d4c5b5153bd175a16c461 (diff)
downloadrneovim-2bd8a5e4b77367c29f3c9ed2091023dc69f35239.tar.gz
rneovim-2bd8a5e4b77367c29f3c9ed2091023dc69f35239.tar.bz2
rneovim-2bd8a5e4b77367c29f3c9ed2091023dc69f35239.zip
Add a colorcolumn character option.
This option allows a character to be displayed in the colorcolumn. This allows the colorcolumn ot have a traditional line if the colorcolumn character is set to a vertical line '│' or even a series of dots for a ':'. The option is a part of the 'listchars' setting under the name 'colorcol'. So 'set listchars=colorcol:│' will work.
-rw-r--r--src/nvim/buffer_defs.h1
-rw-r--r--src/nvim/eval/funcs.c2
-rw-r--r--src/nvim/option.c1
-rw-r--r--src/nvim/screen.c3
4 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 5451f908cd..2db5a95304 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -1231,6 +1231,7 @@ struct window_S {
int trail;
int *multispace;
int conceal;
+ int colorcol;
} w_p_lcs_chars;
// 'fillchars' characters. Defaults set in set_chars_option().
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index e7fb6ed504..fa5a3eb67b 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -4457,6 +4457,8 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr)
"wsl",
#endif
"nvim",
+ "colorcolchar",
+ "omnihighlight",
};
bool n = false;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 4073ab08d9..f7c667dfb7 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3474,6 +3474,7 @@ static char_u *set_chars_option(win_T *wp, char_u **varp, bool set)
{ &wp->w_p_lcs_chars.lead, "lead", NUL },
{ &wp->w_p_lcs_chars.trail, "trail", NUL },
{ &wp->w_p_lcs_chars.conceal, "conceal", NUL },
+ { &wp->w_p_lcs_chars.colorcol, "colorcol", NUL },
};
if (varp == &p_lcs || varp == &wp->w_p_lcs) {
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 0a75e2d09f..155f706699 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -4141,6 +4141,9 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
col_attr = cuc_attr;
} else if (draw_color_col && VCOL_HLC == *color_cols) {
col_attr = mc_attr;
+ // Draw the colorcolumn character.
+ c = wp->w_p_lcs_chars.colorcol;
+ schar_from_char(linebuf_char[off], c);
}
col_attr = hl_combine_attr(col_attr, line_attr);