mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
'listchars': Whitespace
highlight group #6367
This commit is contained in:
parent
6afa7d66cd
commit
bc6d868d00
@ -3171,26 +3171,14 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Think twice when using ":q!" or ":qa!".
|
||||
|
||||
*'highlight'* *'hl'*
|
||||
'highlight' 'hl' string (default (as a single string):
|
||||
"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,w:WarningMsg,W:WildMenu,
|
||||
f:Folded,F:FoldColumn,A:DiffAdd,
|
||||
C:DiffChange,D:DiffDelete,T:DiffText,
|
||||
>:SignColumn,B:SpellBad,P:SpellCap,
|
||||
R:SpellRare,L:SpellLocal,-:Conceal,
|
||||
+:Pmenu,=:PmenuSel,x:PmenuSbar,
|
||||
X:PmenuThumb")
|
||||
'highlight' 'hl' string (default: string of "c:group,..." pairs)
|
||||
global
|
||||
This option can be used to set highlighting mode for various
|
||||
occasions. It is a comma separated list of character pairs. The
|
||||
first character in a pair gives the occasion, the second the mode to
|
||||
use for that occasion. The occasions are:
|
||||
|hl-SpecialKey| 8 Meta and special keys listed with ":map"
|
||||
|hl-Whitespace| 0
|
||||
|hl-EndOfBuffer| ~ lines after the last line in the buffer
|
||||
|hl-TermCursor| z Cursor in a focused terminal
|
||||
|hl-TermCursorNC| Z Cursor in an unfocused terminal
|
||||
@ -3233,6 +3221,15 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
|hl-PmenuSbar| x popup menu scrollbar
|
||||
|hl-PmenuThumb| X popup menu scrollbar thumb
|
||||
|
||||
|hl-TabLine| *
|
||||
|hl-TabLineFill| _
|
||||
|hl-TabLineSel| #
|
||||
|
||||
|hl-ColorColumn| o
|
||||
|hl-CursorColumn| !
|
||||
|hl-CursorLine| .
|
||||
|hl-QuickFixLine| q
|
||||
|
||||
The display modes are:
|
||||
r reverse (termcap entry "mr" and "me")
|
||||
i italic (termcap entry "ZH" and "ZR")
|
||||
@ -3917,9 +3914,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
:set lcs=tab:>-,trail:-
|
||||
:set lcs=tab:>-,eol:<,nbsp:%
|
||||
:set lcs=extends:>,precedes:<
|
||||
< The "NonText" highlighting will be used for "eol", "extends" and
|
||||
"precedes". "SpecialKey" for "nbsp", "space", "tab" and "trail".
|
||||
|hl-NonText| |hl-SpecialKey|
|
||||
< |hl-NonText| highlighting will be used for "eol", "extends" and
|
||||
"precedes". |hl-Whitespace| for "nbsp", "space", "tab" and "trail".
|
||||
|
||||
*'lpl'* *'nolpl'* *'loadplugins'* *'noloadplugins'*
|
||||
'loadplugins' 'lpl' boolean (default on)
|
||||
|
@ -4899,32 +4899,28 @@ PmenuThumb Popup menu: Thumb of the scrollbar.
|
||||
*hl-Question*
|
||||
Question |hit-enter| prompt and yes/no questions
|
||||
*hl-QuickFixLine*
|
||||
QuickFixLine The selected |quickfix| item in the quickfix window.
|
||||
|hl-CursorLine| is combined with this when the cursor is on
|
||||
the currently selected quickfix item.
|
||||
QuickFixLine Current |quickfix| item in the quickfix window. Combined with
|
||||
|hl-CursorLine| when the cursor is there.
|
||||
*hl-Search*
|
||||
Search Last search pattern highlighting (see 'hlsearch').
|
||||
Also used for highlighting the current line in the quickfix
|
||||
window and similar items that need to stand out.
|
||||
Also used for similar items that need to stand out.
|
||||
*hl-SpecialKey*
|
||||
SpecialKey Meta and special keys listed with ":map", also for text used
|
||||
to show unprintable characters in the text, 'listchars'.
|
||||
Generally: text that is displayed differently from what it
|
||||
really is.
|
||||
SpecialKey Unprintable characters: text displayed differently from what
|
||||
it really is. But not 'listchars' whitespace. |hl-Whitespace|
|
||||
*hl-SpellBad*
|
||||
SpellBad Word that is not recognized by the spellchecker. |spell|
|
||||
This will be combined with the highlighting used otherwise.
|
||||
Combined with the highlighting used otherwise.
|
||||
*hl-SpellCap*
|
||||
SpellCap Word that should start with a capital. |spell|
|
||||
This will be combined with the highlighting used otherwise.
|
||||
Combined with the highlighting used otherwise.
|
||||
*hl-SpellLocal*
|
||||
SpellLocal Word that is recognized by the spellchecker as one that is
|
||||
used in another region. |spell|
|
||||
This will be combined with the highlighting used otherwise.
|
||||
Combined with the highlighting used otherwise.
|
||||
*hl-SpellRare*
|
||||
SpellRare Word that is recognized by the spellchecker as one that is
|
||||
hardly ever used. |spell|
|
||||
This will be combined with the highlighting used otherwise.
|
||||
Combined with the highlighting used otherwise.
|
||||
*hl-StatusLine*
|
||||
StatusLine status line of current window
|
||||
*hl-StatusLineNC*
|
||||
@ -4943,6 +4939,8 @@ Title titles for output from ":set all", ":autocmd" etc.
|
||||
Visual Visual mode selection
|
||||
*hl-WarningMsg*
|
||||
WarningMsg warning messages
|
||||
*hl-Whitespace*
|
||||
Whitespace "nbsp", "space", "tab" and "trail" in 'listchars'
|
||||
*hl-WildMenu*
|
||||
WildMenu current match in 'wildmenu' completion
|
||||
|
||||
|
@ -147,6 +147,7 @@ Highlight groups:
|
||||
|hl-Substitute|
|
||||
|hl-TermCursor|
|
||||
|hl-TermCursorNC|
|
||||
|hl-Whitespace| highlights 'listchars' whitespace
|
||||
|
||||
==============================================================================
|
||||
4. Changed features *nvim-features-changed*
|
||||
|
@ -464,6 +464,7 @@ typedef enum {
|
||||
, HLF_CUL // 'cursurline'
|
||||
, HLF_MC // 'colorcolumn'
|
||||
, HLF_QFL // selected quickfix line
|
||||
, HLF_0 // Whitespace
|
||||
, HLF_COUNT // MUST be the last one
|
||||
} hlf_T;
|
||||
|
||||
@ -472,7 +473,7 @@ typedef enum {
|
||||
#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', 'q' }
|
||||
'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', '0' }
|
||||
|
||||
EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */
|
||||
EXTERN int highlight_user[9]; /* User[1-9] attributes */
|
||||
|
@ -245,7 +245,8 @@ typedef struct vimoption {
|
||||
"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,q:QuickFixLine"
|
||||
"!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine," \
|
||||
"0:Whitespace"
|
||||
|
||||
/*
|
||||
* options[] is initialized here.
|
||||
|
@ -3409,7 +3409,7 @@ win_line (
|
||||
|| (c == ' ' && lcs_space && ptr - line <= trailcol))) {
|
||||
c = (c == ' ') ? lcs_space : lcs_nbsp;
|
||||
n_attr = 1;
|
||||
extra_attr = hl_attr(HLF_8);
|
||||
extra_attr = hl_attr(HLF_0);
|
||||
saved_attr2 = char_attr; // save current attr
|
||||
mb_c = c;
|
||||
if (enc_utf8 && (*mb_char2len)(c) > 1) {
|
||||
@ -3424,7 +3424,7 @@ win_line (
|
||||
if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') {
|
||||
c = lcs_trail;
|
||||
n_attr = 1;
|
||||
extra_attr = hl_attr(HLF_8);
|
||||
extra_attr = hl_attr(HLF_0);
|
||||
saved_attr2 = char_attr; // save current attr
|
||||
mb_c = c;
|
||||
if (enc_utf8 && (*mb_char2len)(c) > 1) {
|
||||
@ -3525,8 +3525,8 @@ win_line (
|
||||
c_extra = lcs_tab2;
|
||||
}
|
||||
n_attr = tab_len + 1;
|
||||
extra_attr = hl_attr(HLF_8);
|
||||
saved_attr2 = char_attr; /* save current attr */
|
||||
extra_attr = hl_attr(HLF_0);
|
||||
saved_attr2 = char_attr; // save current attr
|
||||
mb_c = c;
|
||||
if (enc_utf8 && (*mb_char2len)(c) > 1) {
|
||||
mb_utf8 = TRUE;
|
||||
|
@ -5916,6 +5916,7 @@ static char *highlight_init_both[] =
|
||||
"default link EndOfBuffer NonText",
|
||||
"default link QuickFixLine Search",
|
||||
"default link Substitute Search",
|
||||
"default link Whitespace NonText",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -30,8 +30,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 700,
|
||||
cell_percentage = 25,
|
||||
cursor_shape = 'vertical',
|
||||
hl_id = 45,
|
||||
id_lm = 46,
|
||||
hl_id = 46,
|
||||
id_lm = 47,
|
||||
mouse_shape = 0,
|
||||
short_name = 'ci' },
|
||||
cmdline_normal = {
|
||||
@ -40,8 +40,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 700,
|
||||
cell_percentage = 0,
|
||||
cursor_shape = 'block',
|
||||
hl_id = 45,
|
||||
id_lm = 46,
|
||||
hl_id = 46,
|
||||
id_lm = 47,
|
||||
mouse_shape = 0,
|
||||
short_name = 'c' },
|
||||
cmdline_replace = {
|
||||
@ -50,8 +50,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 700,
|
||||
cell_percentage = 20,
|
||||
cursor_shape = 'horizontal',
|
||||
hl_id = 45,
|
||||
id_lm = 46,
|
||||
hl_id = 46,
|
||||
id_lm = 47,
|
||||
mouse_shape = 0,
|
||||
short_name = 'cr' },
|
||||
insert = {
|
||||
@ -60,8 +60,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 700,
|
||||
cell_percentage = 25,
|
||||
cursor_shape = 'vertical',
|
||||
hl_id = 45,
|
||||
id_lm = 46,
|
||||
hl_id = 46,
|
||||
id_lm = 47,
|
||||
mouse_shape = 0,
|
||||
short_name = 'i' },
|
||||
more = {
|
||||
@ -76,8 +76,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 700,
|
||||
cell_percentage = 0,
|
||||
cursor_shape = 'block',
|
||||
hl_id = 45,
|
||||
id_lm = 46,
|
||||
hl_id = 46,
|
||||
id_lm = 47,
|
||||
mouse_shape = 0,
|
||||
short_name = 'n' },
|
||||
operator = {
|
||||
@ -86,8 +86,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 700,
|
||||
cell_percentage = 50,
|
||||
cursor_shape = 'horizontal',
|
||||
hl_id = 45,
|
||||
id_lm = 45,
|
||||
hl_id = 46,
|
||||
id_lm = 46,
|
||||
mouse_shape = 0,
|
||||
short_name = 'o' },
|
||||
replace = {
|
||||
@ -96,8 +96,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 700,
|
||||
cell_percentage = 20,
|
||||
cursor_shape = 'horizontal',
|
||||
hl_id = 45,
|
||||
id_lm = 46,
|
||||
hl_id = 46,
|
||||
id_lm = 47,
|
||||
mouse_shape = 0,
|
||||
short_name = 'r' },
|
||||
showmatch = {
|
||||
@ -106,8 +106,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 175,
|
||||
cell_percentage = 0,
|
||||
cursor_shape = 'block',
|
||||
hl_id = 45,
|
||||
id_lm = 45,
|
||||
hl_id = 46,
|
||||
id_lm = 46,
|
||||
short_name = 'sm' },
|
||||
statusline_drag = {
|
||||
mouse_shape = 0,
|
||||
@ -121,8 +121,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 700,
|
||||
cell_percentage = 0,
|
||||
cursor_shape = 'block',
|
||||
hl_id = 45,
|
||||
id_lm = 46,
|
||||
hl_id = 46,
|
||||
id_lm = 47,
|
||||
mouse_shape = 0,
|
||||
short_name = 'v' },
|
||||
visual_select = {
|
||||
@ -131,8 +131,8 @@ describe('ui/cursor', function()
|
||||
blinkwait = 700,
|
||||
cell_percentage = 35,
|
||||
cursor_shape = 'vertical',
|
||||
hl_id = 45,
|
||||
id_lm = 45,
|
||||
hl_id = 46,
|
||||
id_lm = 46,
|
||||
mouse_shape = 0,
|
||||
short_name = 've' },
|
||||
vsep_drag = {
|
||||
|
@ -200,57 +200,30 @@ describe('Default highlight groups', function()
|
||||
|
||||
it('insert mode text', function()
|
||||
feed('i')
|
||||
screen:try_resize(53, 4)
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{1:-- INSERT --} |
|
||||
]], {[0] = {bold=true, foreground=Screen.colors.Blue},
|
||||
[1] = {bold = true}})
|
||||
end)
|
||||
|
||||
it('end of file markers', function()
|
||||
screen:try_resize(53, 4)
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]], {[1] = {bold = true, foreground = Screen.colors.Blue}})
|
||||
end)
|
||||
|
||||
it('"wait return" text', function()
|
||||
screen:try_resize(53, 4)
|
||||
feed(':ls<cr>')
|
||||
screen:expect([[
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
:ls |
|
||||
1 %a "[No Name]" line 1 |
|
||||
@ -259,23 +232,15 @@ describe('Default highlight groups', function()
|
||||
[1] = {bold = true, foreground = Screen.colors.SeaGreen}})
|
||||
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
|
||||
end)
|
||||
|
||||
it('can be cleared and linked to other highlight groups', function()
|
||||
screen:try_resize(53, 4)
|
||||
execute('highlight clear ModeMsg')
|
||||
feed('i')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
-- INSERT -- |
|
||||
]], {[0] = {bold=true, foreground=Screen.colors.Blue},
|
||||
[1] = {bold=true}})
|
||||
@ -287,37 +252,19 @@ describe('Default highlight groups', function()
|
||||
^ |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{1:-- INSERT --} |
|
||||
]], {[0] = {bold=true, foreground=Screen.colors.Blue},
|
||||
[1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}})
|
||||
end)
|
||||
|
||||
it('can be cleared by assigning NONE', function()
|
||||
screen:try_resize(53, 4)
|
||||
execute('syn keyword TmpKeyword neovim')
|
||||
execute('hi link TmpKeyword ErrorMsg')
|
||||
insert('neovim')
|
||||
screen:expect([[
|
||||
{1:neovi^m} |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]], {
|
||||
@ -330,18 +277,34 @@ describe('Default highlight groups', function()
|
||||
neovi^m |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
|
||||
end)
|
||||
|
||||
it('Whitespace highlight', function()
|
||||
screen:try_resize(53, 4)
|
||||
execute('highlight NonText gui=NONE guifg=#FF0000')
|
||||
execute('set listchars=space:.,tab:>-,trail:*,eol:¬ list')
|
||||
insert(' ne \t o\tv im ')
|
||||
screen:expect([[
|
||||
ne{0:.>----.}o{0:>-----}v{0:..}im{0:*^*¬} |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
|
|
||||
]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
|
||||
]], {
|
||||
[0] = {foreground=Screen.colors.Red},
|
||||
[1] = {foreground=Screen.colors.Blue},
|
||||
})
|
||||
execute('highlight Whitespace gui=NONE guifg=#0000FF')
|
||||
screen:expect([[
|
||||
ne{1:.>----.}o{1:>-----}v{1:..}im{1:*^*}{0:¬} |
|
||||
{0:~ }|
|
||||
{0:~ }|
|
||||
:highlight Whitespace gui=NONE guifg=#0000FF |
|
||||
]], {
|
||||
[0] = {foreground=Screen.colors.Red},
|
||||
[1] = {foreground=Screen.colors.Blue},
|
||||
})
|
||||
end)
|
||||
end)
|
||||
|
||||
@ -510,7 +473,7 @@ describe("'listchars' highlight", function()
|
||||
},
|
||||
})
|
||||
execute('highlight clear ModeMsg')
|
||||
execute('highlight SpecialKey guifg=#FF0000')
|
||||
execute('highlight Whitespace guifg=#FF0000')
|
||||
execute('set cursorline')
|
||||
execute('set tabstop=8')
|
||||
execute('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
|
||||
@ -606,7 +569,7 @@ describe("'listchars' highlight", function()
|
||||
},
|
||||
})
|
||||
execute('highlight clear ModeMsg')
|
||||
execute('highlight SpecialKey guifg=#FF0000')
|
||||
execute('highlight Whitespace guifg=#FF0000')
|
||||
execute('set cursorline')
|
||||
execute('set tabstop=8')
|
||||
execute('set nowrap')
|
||||
@ -653,7 +616,7 @@ describe("'listchars' highlight", function()
|
||||
[3] = {foreground=Screen.colors.Green1},
|
||||
})
|
||||
execute('highlight clear ModeMsg')
|
||||
execute('highlight SpecialKey guifg=#FF0000')
|
||||
execute('highlight Whitespace guifg=#FF0000')
|
||||
execute('highlight Error guifg=#00FF00')
|
||||
execute('set nowrap')
|
||||
feed('ia \t bc \t <esc>')
|
||||
|
Loading…
Reference in New Issue
Block a user