From 87c7258ccc683965d2b6a5190f1e98d74c8d25d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 2 Jul 2015 11:06:18 +0200 Subject: Add :show command to display special symbols for whitespaces Enable/disable by setting to 0/1 respectively: :set show spaces=0 tabs=0 newlines=1 --- config.def.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'config.def.h') diff --git a/config.def.h b/config.def.h index 9d491a0..dff70d5 100644 --- a/config.def.h +++ b/config.def.h @@ -827,6 +827,11 @@ enum { COLOR_COMMENT = COLOR_SYNTAX7, COLOR_IDENTIFIER = COLOR_SYNTAX8, COLOR_TYPE = COLOR_SYNTAX9, + COLOR_WHITESPACE = COLOR_COMMENT, + COLOR_SPACES = COLOR_WHITESPACE, + COLOR_TABS = COLOR_WHITESPACE, + COLOR_EOL = COLOR_WHITESPACE, + COLOR_EOF = COLOR_WHITESPACE, }; static Color colors[] = { @@ -894,6 +899,12 @@ static Color colors[] = { &colors[COLOR_PREPROCESSOR], \ } +#define SYNTAX_SPACES { "\xC2\xB7", &colors[COLOR_SPACES] } +#define SYNTAX_TABS { "\xE2\x96\xB6", &colors[COLOR_TABS] } +#define SYNTAX_TABS_FILL { " ", &colors[COLOR_TABS] } +#define SYNTAX_EOL { "\xE2\x8F\x8E", &colors[COLOR_EOL] } +#define SYNTAX_EOF { "~", &colors[COLOR_EOF] } + /* these rules are applied top to bottom, first match wins. Therefore more 'greedy' * rules such as for comments should be the first entries. * @@ -905,8 +916,16 @@ static Syntax syntaxes[] = {{ .settings = (const char*[]){ "set number", "set autoindent", + "set show spaces=0 tabs=1 newlines=1", NULL }, + .symbols = { + SYNTAX_SPACES, + SYNTAX_TABS, + SYNTAX_TABS_FILL, + SYNTAX_EOL, + SYNTAX_EOF, + }, .rules = { SYNTAX_MULTILINE_COMMENT, SYNTAX_SINGLE_LINE_COMMENT, -- cgit v1.2.3