From c7d1ec0a099bcb6a529ba2426a803874e260d75e Mon Sep 17 00:00:00 2001 From: Tim Allen Date: Tue, 25 Sep 2018 18:42:07 +1000 Subject: [PATCH] mapping.asciidoc: add tips for mappings that trigger commands --- doc/pages/mapping.asciidoc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/pages/mapping.asciidoc b/doc/pages/mapping.asciidoc index c21bd90b..8e6699f7 100644 --- a/doc/pages/mapping.asciidoc +++ b/doc/pages/mapping.asciidoc @@ -53,6 +53,28 @@ set to the same sequence of keys passed using the *expected* argument. For more information about the values of the *scope* parameter, refer to <>. +== Mapping commands + +It's common to use a normal-mode or user-mode mapping to trigger a command, +like this: + +---- +map global user n ': make-next-error' +---- + +Note the space between the `:` and the command. This prevents Kakoune from +adding this command to the prompt history, so the user won't have to scroll +past it to review commands they actually typed. + +If you make a normal-mode mapping, you can prefix it with a count or a register +name like any other normal-mode key. You can forward this information to the +command you invoke with the `%val{count}` and `%val{register}` expansions +(See <>). For example: + +---- +map global normal = ': echo Got count %val{count} and reg %val{register}' +---- + == Mappable keys See <> to discover the list of default bindings.