From aba03932eeade5af887355d6fadb58ad0dda6b89 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 20 Feb 2019 14:33:55 -0700 Subject: Add a colorcolumn character option. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/nvim/buffer_defs.h | 1 + src/nvim/eval/funcs.c | 2 ++ src/nvim/option.c | 1 + src/nvim/screen.c | 3 +++ 4 files changed, 7 insertions(+) diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index d4b526dd1a..575de4d0cb 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 7701688b49..0525352e1c 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -4550,6 +4550,8 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr) "winaltkeys", "writebackup", "nvim", + "colorcolchar", + "omnihighlight", }; bool n = false; diff --git a/src/nvim/option.c b/src/nvim/option.c index 659965b64c..8846a26849 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3553,6 +3553,7 @@ static char *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 957a151ea1..f083065b4c 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -4181,6 +4181,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); -- cgit