Skip to content

Syntax of Map command

akahuku edited this page Aug 4, 2017 · 1 revision

wasavi has three maps as follows:

  • normal map: referenced to normal mode
  • bound map: referenced to bound/bound_line mode
  • input map: referenced to insert/overwrite mode

The ex command map and map! manipulates these maps. By default, map handles both normal map and bound map. On the other hand, map! handles input map. You can change which map the command handles with "attribute" described below.

map map! commands can take 0 to 2 arguments. In addition, attribute can be placed before arguments. An attribute is comma-delimited string whose first character is [ and last character is ].

Valid component of attribute is either the above map name (normal, bound, input) or clear, final, noremap. If the attribute contains map names, that map are selected instead of the default maps.

clear attribute

If the attribute contains clear, all the rules defined for the selected maps will be deleted. Arguments are not used.

examples:
:map [clear]
:map [normal, clear]

When there is no argument

map map! commands shows all the rules defined for the selected maps.

examples:
:map
:map [normal, input]

When there is one argument

map map! commands shows all the rules whose argument partially match the rule's LHS.

examples:
:map g
:map [bound] g

When there are two arguments

map map! commands registers a rule for all selected maps with first argument as LHS and second argument as RHS. If the attribute includes final or noremap, the rule is registered as non-recursive.

examples:
:map gh ^
:map [normal, final] gh ^