Key mappings allow to alter actions of key presses. Each key mapping is
associated with a mode and only has effect when the mode is active. Following
commands allow the user to substitute one sequence of key presses by another.
-
+.TP
.BI Syntax: " :{m}map {lhs} {rhs}"
Note that the \fIlhs\fP ends with the first found space. If you want to use
space also in the {lhs} you have to escape this with a single `\\' like shown
in the examples.
+.br
+The \fIrhs\fP starts with the first none space char. If you want a \fIrhs\fP
+that starts with a space, you have to use "<Space>".
.RS 0
.TP
.PD 0
As special key names have the format \fI<...>\fP. Following special keys can
be used <Left>, <Up>, <Right>, <Down> for the cursor keys, <Tab>, <Esc>, <CR>,
-<F1>-<F12> and <C-A>-<C-Z>.
+<Space>, <F1>-<F12> and <C-A>-<C-Z>.
.TP
.BI ":nm[ap] {" lhs "} {" rhs }
.TP
{"<Tab>", 5, "\t", 1},
{"<S-Tab>", 7, CSI_STR "kB", 3},
{"<Esc>", 5, "\x1b", 1},
+ {"<Space>", 7, "\x20", 1},
{"<Up>", 4, CSI_STR "ku", 3},
{"<Down>", 6, CSI_STR "kd", 3},
{"<Left>", 6, CSI_STR "kl", 3},
ASSERT_MAPPING("a", "[a]");
ASSERT_MAPPING("b", "[b]");
ASSERT_MAPPING("[c]", "c");
+ ASSERT_MAPPING("d", " [d]");
ASSERT_MAPPING("<Tab>", "[tab]");
ASSERT_MAPPING("<S-Tab>", "[shift-tab]");
ASSERT_MAPPING("<C-F>", "[ctrl-f]");
/* add some mappings to test */
map_insert("a", "[a]", 't', false); /* inlen < mappedlen */
map_insert("b", "[b]", 't', false);
+ map_insert("d", "<Space>[d]", 't', false);
map_insert("[c]", "c", 't', false); /* inlen > mappedlen */
map_insert("foobar", "[baz]", 't', false);
map_insert("<Tab>", "[tab]", 't', false);