diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-10 21:11:27 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-10 21:11:27 +0100 |
commit | 1b884a0053982335f644eec6c71027706bf3c522 (patch) | |
tree | 711868d7876566aae13c9b803c5a92e0d3d42329 /runtime/doc/map.txt | |
parent | 70249ee831df357c1a5475473fc84c40d101a67d (diff) | |
download | vim-git-1b884a0053982335f644eec6c71027706bf3c522.tar.gz |
Update runtime files.
Diffstat (limited to 'runtime/doc/map.txt')
-rw-r--r-- | runtime/doc/map.txt | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 5132507b0..bf391305d 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 8.2. Last change: 2020 Nov 21 +*map.txt* For Vim version 8.2. Last change: 2020 Dec 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -909,7 +909,7 @@ Insert mode to avoid every key with a modifier causing Insert mode to end. 1.12 MAPPING AN OPERATOR *:map-operator* An operator is used before a {motion} command. To define your own operator -you must create mapping that first sets the 'operatorfunc' option and then +you must create a mapping that first sets the 'operatorfunc' option and then invoke the |g@| operator. After the user types the {motion} command the specified function will be called. @@ -1321,15 +1321,15 @@ last defined. Example: > See |:verbose-cmd| for more information. *E174* *E182* -:com[mand][!] [{attr}...] {cmd} {rep} +:com[mand][!] [{attr}...] {cmd} {repl} Define a user command. The name of the command is - {cmd} and its replacement text is {rep}. The command's - attributes (see below) are {attr}. If the command - already exists, an error is reported, unless a ! is - specified, in which case the command is redefined. - There is one exception: When sourcing a script again, - a command that was previously defined in that script - will be silently replaced. + {cmd} and its replacement text is {repl}. The + command's attributes (see below) are {attr}. If the + command already exists, an error is reported, unless a + ! is specified, in which case the command is + redefined. There is one exception: When sourcing a + script again, a command that was previously defined in + that script will be silently replaced. :delc[ommand] {cmd} *:delc* *:delcommand* *E184* @@ -1539,11 +1539,11 @@ feature. Use the full name for new scripts. Replacement text ~ -The replacement text for a user defined command is scanned for special escape -sequences, using <...> notation. Escape sequences are replaced with values -from the entered command line, and all other text is copied unchanged. The -resulting string is executed as an Ex command. To avoid the replacement use -<lt> in place of the initial <. Thus to include "<bang>" literally use +The replacement text {repl} for a user defined command is scanned for special +escape sequences, using <...> notation. Escape sequences are replaced with +values from the entered command line, and all other text is copied unchanged. +The resulting string is executed as an Ex command. To avoid the replacement +use <lt> in place of the initial <. Thus to include "<bang>" literally use "<lt>bang>". The valid escape sequences are @@ -1669,6 +1669,11 @@ errors and the "update" command to write modified buffers): > This will invoke: > :call Allargs("%s/foo/bar/ge|update") < +If the command is defined in Vim9 script (a script that starts with +`:vim9script` and in a `:def` function) then {repl} will be executed as in Vim9 +script. Thus this depends on where the command is defined, not where it is +used. + When defining a user command in a script, it will be able to call functions local to the script and use mappings local to the script. When the user invokes the user command, it will run in the context of the script it was |