Skip to content

Commit 0931d5f

Browse files
committed
Mapping: add missing doc
1 parent 07e22d1 commit 0931d5f

File tree

1 file changed

+118
-3
lines changed

1 file changed

+118
-3
lines changed

doc/vital/Mapping.txt

Lines changed: 118 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vital/Mapping.txt* Utilities for mapping.
1+
*vital/Mapping.txt* Utilities for mapping / abbreviation.
22

33
Maintainer: tyru <[email protected]>
44

@@ -12,14 +12,129 @@ INTERFACE |Vital.Mapping-interface|
1212
==============================================================================
1313
INTRODUCTION *Vital.Mapping-introduction*
1414

15-
*Vital.Mapping* is TODO
15+
*Vital.Mapping* is a utility functions related to |:map|, |:unmap|,
16+
|:abbreviate|, |:unabbreviate| commands.
1617

1718
==============================================================================
1819
INTERFACE *Vital.Mapping-interface*
1920
------------------------------------------------------------------------------
2021
FUNCTIONS *Vital.Mapping-functions*
2122

22-
TODO
23+
*Mapping.execute_abbr_command()*
24+
execute_abbr_command({mode}, {dict}, {lhs}, {rhs})
25+
Execute `get_abbr_command(mode, dict, lhs, rhs)` result.
26+
See |Mapping.get_abbr_command()|.
27+
28+
*Mapping.execute_map_command()*
29+
execute_map_command({mode}, {dict}, {lhs}, {rhs})
30+
Execute `get_map_command(mode, dict, lhs, rhs)` result.
31+
See |Mapping.get_map_command()|.
32+
33+
*Mapping.execute_unmap_command()*
34+
execute_unmap_command({mode}, {dict}, {lhs})
35+
Execute `get_unmap_command(mode, dict, lhs)` result.
36+
See |Mapping.get_unmap_command()|.
37+
38+
*Mapping.get_all_modes()*
39+
get_all_modes()
40+
Returns string which represents all mode characters ("noiclxs").
41+
NOTE: "v" is not contained. Because "x" and "s" already mean "v".
42+
43+
*Mapping.get_all_modes_list()*
44+
get_all_modes_list()
45+
Returns |List| which represents all mode characters.
46+
Same as `split(get_all_modes(), '\zs')` .
47+
See |Mapping.get_all_modes()|.
48+
49+
*Mapping.get_abbr_command()*
50+
get_abbr_command({mode}, {dict}, {lhs}, {rhs})
51+
Constructs |:abbreviate| command string.
52+
{mode} is a character of mode.
53+
{dict} is a |Dictionary| of options.
54+
{lhs} and {rhs} are strings of lhs/rhs of |:map| command.
55+
The options can be created by |Mapping.options_chars2dict()| or
56+
|maparg()|'s return value when {dict} is non-zero.
57+
58+
*Mapping.get_map_command()*
59+
get_map_command({mode}, {dict}, {lhs}, {rhs})
60+
Constructs |:map| command string.
61+
{mode} is a character of mode.
62+
{dict} is a |Dictionary| of options.
63+
{lhs} and {rhs} are strings of lhs/rhs of |:map| command.
64+
The options can be created by |Mapping.options_chars2dict()| or
65+
|maparg()|'s return value when {dict} is non-zero.
66+
67+
*Mapping.get_unabbr_command()*
68+
get_unabbr_command({mode}, {dict}, {lhs})
69+
Constructs |:unabbreviate| command string.
70+
{mode} is a character of mode.
71+
{dict} is a |Dictionary| of options.
72+
{lhs} is a string of lhs of |:map| command.
73+
The options can be created by |Mapping.options_chars2dict()| or
74+
|maparg()|'s return value when {dict} is non-zero.
75+
76+
*Mapping.get_unmap_command()*
77+
get_unmap_command({mode}, {dict}, {lhs})
78+
Constructs |:unabbreviate| command string.
79+
{mode} is a character of mode.
80+
{dict} is a |Dictionary| of options.
81+
{lhs} is a string of lhs of |:map| command.
82+
The options can be created by |Mapping.options_chars2dict()| or
83+
|maparg()|'s return value when {dict} is non-zero.
84+
85+
*Mapping.options_chars2dict()*
86+
options_chars2dict({chars})
87+
{chars} is a string which represents characters of options.
88+
The return value is a |Dictionary| which is same as |maparg()|'s
89+
return value when {dict} is non-zero.
90+
91+
chars key ~
92+
"e" expr
93+
"b" buffer
94+
"s" silent
95+
"S" script
96+
"u" unique
97+
"r" noremap (inverse)
98+
"n" nowait
99+
100+
Example: >
101+
options_chars2dict("bs") = {
102+
"expr": 0,
103+
"buffer": 1,
104+
"silent": 1,
105+
"script": 0,
106+
"unique": 0,
107+
"noremap": 1,
108+
"nowait": 0,
109+
}
110+
<
111+
*Mapping.options_chars2raw()*
112+
options_chars2raw({chars})
113+
Same as `options_dict2raw(options_chars2dict(chars))` .
114+
See |Mapping.options_dict2raw()| and |Mapping.options_chars2dict()|.
115+
116+
Example: >
117+
options_dict2chars('eb') = '<expr><buffer>'
118+
<
119+
*Mapping.options_dict2chars()*
120+
options_dict2chars({dict})
121+
Converts {dict} to characters of options.
122+
123+
Example: >
124+
options_dict2chars({'expr': 1, 'buffer': 1}) = 'eb'
125+
<
126+
*Mapping.options_dict2raw()*
127+
options_dict2raw({dict})
128+
{dict} is a |Dictionary| which represents options.
129+
See |Mapping.options_chars2dict()| for the options.
130+
131+
Example: >
132+
options_dict2raw({'expr': 1, 'buffer': 1}) = '<expr><buffer>'
133+
<
134+
*Mapping.is_mode_char()*
135+
is_mode_char({char})
136+
Returns non-zero if {char} is a character one of
137+
"v", "n", "o", "i", "c", "l", "x", "s".
23138

24139
==============================================================================
25140
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl

0 commit comments

Comments
 (0)