From f72f638f976347e2f14fc6ae5e5293c02d5ccfc1 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 27 Dec 2017 19:30:23 +0100 Subject: doc: job/channel, misc #7783 doc: termios defaults. ref #6992 doc: :help shell-powershell doc: provider: Python minimum version is 2.7, 3.4 doc: remove :!start special-case. #5844 doc: mention #7917 change which accepts empty Array for Dictionary parameter doc: pseudokey doc: lmap change #5658 doc: -s, -es --- runtime/doc/map.txt | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 7633dbf352..804b7410f6 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -234,8 +234,7 @@ For this reason the following is blocked: - Moving the cursor is allowed, but it is restored afterwards. - If the cmdline is changed, the old text and cursor position are restored. If you want the mapping to do any of these let the returned characters do -that. Alternatively use a || mapping which doesn't have these -restrictions. +that. Or use a || mapping (which doesn't have these restrictions). You can use getchar(), it consumes typeahead if there is any. E.g., if you have these mappings: > @@ -274,29 +273,30 @@ again for using . This does work: > Using 0x80 as a single byte before other text does not work, it will be seen as a special key. - ** *:map-command* -A command mapping is a mapping that directly executes a command. Command -mappings are written by placing a command in between and in the -rhs of a mapping (in any mode): > - noremap echo mode(1) + ** *:map-cmd* +The pseudokey may be used to define a "command mapping", which executes +the command directly (without changing modes, etc.). Where you might use +":..." in the {lhs} of a mapping, you can instead use "...". +Example: > + noremap x echo mode(1) < +This is more flexible than `:` in visual and operator-pending mode, or +`:` in insert-mode, because the commands are executed directly in the +current mode (instead of always going to normal-mode). Visual-mode is +preserved, so tricks with |gv| are not needed. Commands can be invoked +directly in cmdline-mode (which otherwise would require timer hacks). + +Unlike mappings, there are no special restrictions on the +command: it is executed as if an (unrestricted) |autocmd| was invoked or an +async event event was processed. + +In select-mode, |:map| and |:vmap| command mappings are executed in +visual-mode. Use |:smap| to handle select-mode. + *E5520* -The command must be complete and ended with a . If the command is -incomplete, an error is raised. |Command-line| mode is never entered. - -This is more flexible than using `:` in visual and operator pending -mode, or `:` in insert mode, as the commands are exectued directly in the -mode, and not normal mode. Also visual mode is not aborted. Commands can be -invoked directly in cmdline mode, which is not simple otherwise (a timer has -to be used). Unlike mappings, there are not any specific restrictions -what the command can do, except for what is normally possible to do in every -specific mode. The command should be executed the same way as if an -(unrestricted) |autocmd| was invoked or an async event event was processed. - -Note: In select mode, |:map| or |:vmap| command mappings will be executed in -visual mode. If a mapping is intended to work in select mode, it is -recomendend to map it using |:smap|, possibly in addition to the same mapping -with |:map| or |:xmap|. + commands must terminate, that is, they must be followed by in the +{lhs} of the mapping definition. |Command-line| mode is never entered. + 1.3 MAPPING AND MODES *:map-modes* *mapmode-nvo* *mapmode-n* *mapmode-v* *mapmode-o* *mapmode-t* -- cgit