From ee26b227e15abc263195d4c746d5dba9f0e6dec4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 21 Feb 2023 23:50:29 +0800 Subject: vim-patch:partial:938ae280c79b (#22356) Update runtime files. https://github.com/vim/vim/commit/938ae280c79b8cdb0fca60336ec4c090ecd8bb5a Partially skip autocmd.txt: needs patch 8.2.5011. Partially skip builtin.txt: needs patch 9.0.0411. Partially skip eval.txt: needs patch 8.2.3783. Cherry-pick :map-meta-keys from patch 9.0.1276. Co-authored-by: Bram Moolenaar --- runtime/doc/map.txt | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index cb8b162eb6..ad0570e9f7 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -764,7 +764,7 @@ option). After that it assumes that the 'q' is to be interpreted as such. If you type slowly, or your system is slow, reset the 'timeout' option. Then you might want to set the 'ttimeout' option. - *map-precedence* + *map-precedence* Buffer-local mappings (defined using |:map-|) take precedence over global mappings. When a buffer-local mapping is the same as a global mapping, Vim will use the buffer-local mapping. In addition, Vim will use a complete @@ -838,6 +838,11 @@ in the original Vi, you would get back the text before the first undo). 1.10 MAPPING ALT-KEYS *:map-alt-keys* +For a readable mapping command the form can be used. Note that +and are different, the latter will use an upper case letter. Actually, + and are the same. Instead of "A" you can use "M". If you have +an actual Meta modifier key, please see |:map-meta-keys|. + In the GUI Nvim handles the |ALT| key itself, thus mapping keys with ALT should always work. But in a terminal Nvim gets a sequence of bytes and has to figure out whether ALT was pressed. Terminals may use ESC to indicate that @@ -847,7 +852,21 @@ milliseconds, the ESC is interpreted as: otherwise it is interpreted as two key presses: {key} -1.11 MAPPING AN OPERATOR *:map-operator* +1.11 MAPPING META-KEYS *:map-meta-keys* + +Mapping keys with the Meta modifier works very similar to using the Alt key. +What key on your keyboard produces the Meta modifier depends on your keyboard +and configuration. + +Note that mapping actually is for using the Alt key. That can be +confusing! It cannot be changed, it would not be backwards compatible. + +For the Meta modifier the "T" character is used. For example, to map Meta-b +in Insert mode: > + :imap terrible + + +1.12 MAPPING AN OPERATOR *:map-operator* An operator is used before a {motion} command. To define your own operator you must create a mapping that first sets the 'operatorfunc' option and then @@ -984,7 +1003,7 @@ non-id The "non-id" type ends in a non-keyword character, the other Examples of strings that cannot be abbreviations: "a.b", "#def", "a b", "_$r" An abbreviation is only recognized when you type a non-keyword character. -This can also be the that ends insert mode or the that ends a +This can also be the that ends Insert mode or the that ends a command. The non-keyword character which ends the abbreviation is inserted after the expanded abbreviation. An exception to this is the character , which is used to expand an abbreviation without inserting any extra @@ -1484,7 +1503,7 @@ which by default correspond to the current line, last line and the whole buffer, relate to arguments, (loaded) buffers, windows or tab pages. Possible values are (second column is the short name used in listing): - -addr=lines Range of lines (this is the default for -range) + -addr=lines Range of lines (this is the default for -range) -addr=arguments arg Range for arguments -addr=buffers buf Range for buffers (also not loaded buffers) -addr=loaded_buffers load Range for loaded buffers -- cgit From 66c384d4e806a5e8de53bc57a05f0ddd8c8a9d1c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 28 Feb 2023 09:34:27 +0100 Subject: vim-patch:partial:dd60c365cd26 (#22437) vim-patch:partial:dd60c365cd26 Update runtime files https://github.com/vim/vim/commit/dd60c365cd2630794be84d63c4fe287124a30b97 Co-authored-by: Bram Moolenaar Skip: eval.txt, repeat.txt (needs `getscriptinfo()`) --- runtime/doc/map.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index ad0570e9f7..3a5223fa3a 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1205,12 +1205,14 @@ functions used in one script use the same name as in other scripts. To avoid this, they can be made local to the script. ** ** *E81* -The string "" can be used in a mapping or menu. +The string "" can be used in a mapping or menu. This is useful if you +have a script-local function that you want to call from a mapping in the same +script. When executing the map command, Vim will replace "" with the special key code , followed by a number that's unique for the script, and an underscore. Example: > :map Add -could define a mapping "23_Add". +would define a mapping "23_Add". When defining a function in a script, "s:" can be prepended to the name to make it local to the script. But when a mapping is executed from outside of -- cgit From 2daf0b37dbfe54a4510c1033531dbaefd168c387 Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Mon, 13 Mar 2023 03:29:11 +0100 Subject: feat(options)!: deprecate paste, remove pastetoggle (#22647) we cannot remove 'paste'. It is very common in plugins and configs. 'pastetoggle' can and should be removed though, it's a total waste of everyone's time because it generates bug reports and doesn't work well, and is useless because bracketed-paste works better. --- runtime/doc/map.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 3a5223fa3a..c65007d1a4 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -695,8 +695,7 @@ this (see |<>|). Example: > :map _ls :!ls -l %:S:echo "the end" To avoid mapping of the characters you type in insert or Command-line mode, -type a CTRL-V first. The mapping in Insert mode is disabled if the 'paste' -option is on. +type a CTRL-V first. *map-error* Note that when an error is encountered (that causes an error message or might cause a beep) the rest of the mapping is not executed. This is Vi-compatible. @@ -1070,8 +1069,6 @@ Abbreviations are never recursive. You can use ":ab f f-o-o" without any problem. But abbreviations can be mapped. {some versions of Vi support recursive abbreviations, for no apparent reason} -Abbreviations are disabled if the 'paste' option is on. - *:abbreviate-local* *:abbreviate-* Just like mappings, abbreviations can be local to a buffer. This is mostly used in a |filetype-plugin| file. Example for a C plugin file: > -- cgit From 747264320c6d8c022fdcb3c9b22f81c9e472e571 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 8 Apr 2023 20:29:23 +0800 Subject: refactor(mappings)!: remove #n as a notation for a function key (#17318) This notation is hardly used and makes the behavior of the from_part argument of nvim_replace_termcodes confusing. --- runtime/doc/map.txt | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index c65007d1a4..cd374c6f34 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -540,28 +540,10 @@ See |:verbose-cmd| for more information. 1.5 MAPPING SPECIAL KEYS *:map-special-keys* -There are two ways to map a special key: -1. The Vi-compatible method: Map the key code. Often this is a sequence that - starts with . To enter a mapping like this you type ":map " and then - you have to type CTRL-V before hitting the function key. Note that when - the key code for the key is in the |terminfo| entry, it will automatically - be translated into the internal code and become the second way of mapping. -2. The second method is to use the internal code for the function key. To - enter such a mapping type CTRL-K and then hit the function key, or use - the form "#1", "#2", .. "#9", "#0", "", "", "", etc. - (see table of keys |key-notation|, all keys from can be used). The - first ten function keys can be defined in two ways: Just the number, like - "#2", and with "", like "". Both stand for function key 2. "#0" - refers to function key 10. - -DETAIL: Vim first checks if a sequence from the keyboard is mapped. If it -isn't the terminal key codes are tried. If a terminal code is found it is -replaced with the internal code. Then the check for a mapping is done again -(so you can map an internal code to something else). What is written into the -script file depends on what is recognized. If the terminal key code was -recognized as a mapping the key code itself is written to the script file. If -it was recognized as a terminal code the internal code is written to the -script file. +To map a function key, use the internal code for it. To enter such a mapping +type CTRL-K and then hit the function key, or use the form "", "", +"", "", "", etc. (see table of keys |key-notation|, all keys +from can be used). 1.6 SPECIAL CHARACTERS *:map-special-chars* -- cgit From e3f36377c156749bbdafc46d8a8cd017f378b4b5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 23 Apr 2023 15:22:55 +0200 Subject: vim-patch:71badf9547e8 (#23285) Update runtime files https://github.com/vim/vim/commit/71badf9547e8f89571b9a095183671cbb333d528 Co-authored-by: Bram Moolenaar --- runtime/doc/map.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index cd374c6f34..164e2d4ec5 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1322,6 +1322,11 @@ can have arguments, or have a range specified. Arguments are subject to completion as filenames, buffers, etc. Exactly how this works depends upon the command's attributes, which are specified when the command is defined. +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 +defined in. This matters if || is used in a command. + There are a number of attributes, split into four categories: argument handling, completion behavior, range handling, and special cases. The attributes are described below, by category. @@ -1770,9 +1775,5 @@ errors and the "update" command to write modified buffers): > This will invoke: > :call Allargs("%s/foo/bar/ge|update") < -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 -defined in. This matters if || is used in a command. vim:tw=78:ts=8:noet:ft=help:norl: -- cgit From a2b9117ca8f8abe8d4c9e2d1bacb73b1902a4e1f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 7 May 2023 08:12:42 +0800 Subject: vim-patch:8.2.1978: making a mapping work in all modes is complicated Problem: Making a mapping work in all modes is complicated. Solution: Add the special key. (Yegappan Lakshmanan, closes vim/vim#7282, closes 4784, based on patch by Bjorn Linse) https://github.com/vim/vim/commit/957cf67d50516ba98716f59c9e1cb6412ec1535d Change docs to match Vim if it's wording is better. Change error numbers to match Vim. Co-authored-by: Bram Moolenaar --- runtime/doc/map.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 164e2d4ec5..fccb6eeb75 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -290,7 +290,7 @@ Therefore the following is blocked for mappings: - 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. (Or use a || mapping instead.) +that, or use a || mapping instead. You can use getchar(), it consumes typeahead if there is any. E.g., if you have these mappings: > @@ -324,19 +324,21 @@ be seen as a special key. ** *:map-cmd* The pseudokey begins a "command mapping", which executes the command -directly (without changing modes). Where you might use ":..." in the +directly without changing modes. Where you might use ":..." in the {rhs} of a mapping, you can instead use "...". Example: > - noremap x echo mode(1) + 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 +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 would otherwise require timer hacks). +directly in Command-line mode (which would otherwise require timer hacks). +Example of using halfway Insert mode: > + nnoremap aText echo mode(1) Added Unlike mappings, there are no special restrictions on the -command: it is executed as if an (unrestricted) |autocommand| was invoked +command: it is executed as if an (unrestricted) |autocmd| was invoked or an async event event was processed. Note: @@ -350,7 +352,7 @@ Note: - In Visual mode you can use `line('v')` and `col('v')` to get one end of the Visual area, the cursor is at the other end. - *E5520* + *E1135* *E1136* commands must terminate, that is, they must be followed by in the {rhs} of the mapping definition. |Command-line| mode is never entered. -- cgit From 29c228dc1087676af5b72f4145ab146cff75156e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 7 May 2023 08:33:06 +0800 Subject: vim-patch:8.2.3887: E1135 is used for two different errors Problem: E1135 is used for two different errors. Solution: Renumber one error. https://github.com/vim/vim/commit/806da5176e9e9ab011d927c4ca33a8dde1769539 Co-authored-by: Bram Moolenaar --- runtime/doc/map.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index fccb6eeb75..9ec592215e 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -352,7 +352,7 @@ Note: - In Visual mode you can use `line('v')` and `col('v')` to get one end of the Visual area, the cursor is at the other end. - *E1135* *E1136* + *E1255* *E1136* commands must terminate, that is, they must be followed by in the {rhs} of the mapping definition. |Command-line| mode is never entered. -- cgit From 057a5bc78d90db50caa85cdb34986fb186f0fd98 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 8 May 2023 13:57:24 +0800 Subject: docs: add some missing changes from Vim runtime updates (#23533) --- runtime/doc/map.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 9ec592215e..37158e2e76 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -338,8 +338,8 @@ Example of using halfway Insert mode: > nnoremap aText echo mode(1) Added 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. +command: it is executed as if an (unrestricted) |autocommand| was invoked +or an async event was processed. Note: - Because avoids mode-changes (unlike ":") it does not trigger @@ -638,6 +638,7 @@ not to be matched with any key sequence. This is useful in plugins ** The special key name "" can be used to handle mouse movement. It needs to be enabled with 'mousemoveevent'. +The |getmousepos()| function can be used to obtain the mouse position. ** ** To map a character by its decimal, octal or hexadecimal number the -- cgit From c11986ed1a816d7ebcb5a5f707e3ef884f278293 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 15 May 2023 09:38:32 +0200 Subject: vim-patch:b7398fe41c9e (#23627) Update runtime files https://github.com/vim/vim/commit/b7398fe41c9e1e731d058105a34158871ee83e3f Co-authored-by: Bram Moolenaar --- runtime/doc/map.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 37158e2e76..ad7901b962 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1730,8 +1730,12 @@ remains unmodified. Also see |f-args-example| below. Overview: XX a\\\ b 'a\ b' XX a\\\\b 'a\\b' XX a\\\\ b 'a\\', 'b' + XX [nothing] +Note that if the "no arguments" situation is to be handled, you have to make +sure that the function can be called without arguments. + Examples for user commands: > " Delete everything after here to the end -- cgit From 473a216a21fdc086ef71e0ca7d40c2fdf5346245 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 11 Jun 2023 12:40:22 +0100 Subject: vim-patch:10e8ff9b2607 (#23977) Update runtime files https://github.com/vim/vim/commit/10e8ff9b26078994cae57c2422b145d37aaf714e Also: - fix a missing `<` in builtin.txt. - edit `:function` `{name}` wording to match the change made for the docs above by Justin in #10619. - link to `*vimrc*` rather than `*init.vim*` in repeat.txt change (as `init.lua` may also be used). Co-authored-by: Bram Moolenaar --- runtime/doc/map.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index ad7901b962..9613092ba9 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -349,7 +349,7 @@ Note: - The command is not echo'ed, no need for . - The {rhs} is not subject to abbreviations nor to other mappings, even if the mapping is recursive. -- In Visual mode you can use `line('v')` and `col('v')` to get one end of the +- In Visual mode you can use `line('v')` and `col('v')` to get one end of the Visual area, the cursor is at the other end. *E1255* *E1136* -- cgit From 0eb02ea90a5a7c2e35bfcf99b701a28ff2901b4b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Jun 2023 20:08:08 +0800 Subject: docs: various clarifications (#23999) Close #18907 Close #20314 Close #23749 --- runtime/doc/map.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 9613092ba9..25ab91b89e 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1391,7 +1391,7 @@ completion can be enabled: -complete=highlight highlight groups -complete=history :history suboptions -complete=locale locale names (as output of locale -a) - -complete=lua Lua expression + -complete=lua Lua expression |:lua| -complete=mapclear buffer argument -complete=mapping mapping name -complete=menu menus -- cgit From 72a6643b1380cdf6f1153d70eeaffb90bdca30d6 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 19 Jun 2023 08:40:33 -0700 Subject: docs #24061 - nvim requires rpc responses in reverse order. https://github.com/neovim/neovim/issues/19932 - NVIM_APPNAME: UIs normally should NOT set this. ref #23520 fix #24050 fix #23660 fix #23353 fix #23337 fix #22213 fix #19161 fix #18088 fix #20693 --- runtime/doc/map.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 25ab91b89e..ffd7b6bc1d 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1546,6 +1546,7 @@ supports incremental command preview: -- If invoked as a preview callback, performs 'inccommand' preview by -- highlighting trailing whitespace in the current buffer. local function trim_space_preview(opts, preview_ns, preview_buf) + vim.cmd('hi clear Whitespace') local line1 = opts.line1 local line2 = opts.line2 local buf = vim.api.nvim_get_current_buf() -- cgit From 036da0d07921e67090d1a62c9a4e382ca09d8584 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 24 Jun 2023 13:47:10 +0200 Subject: fix(docs): vimdoc syntax errors gen_help_html: truncate parse-error sample text --- runtime/doc/map.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index ffd7b6bc1d..56e58baad8 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1051,8 +1051,7 @@ typed after an abbreviation: > There are no default abbreviations. Abbreviations are never recursive. You can use ":ab f f-o-o" without any -problem. But abbreviations can be mapped. {some versions of Vi support -recursive abbreviations, for no apparent reason} +problem. But abbreviations can be mapped. *:abbreviate-local* *:abbreviate-* Just like mappings, abbreviations can be local to a buffer. This is mostly -- cgit From f748a73a357710db6094d4a428cd056f5df226a9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 9 Nov 2023 19:48:50 +0800 Subject: vim-patch:8.2.4861: it is not easy to restore saved mappings Problem: It is not easy to restore saved mappings. Solution: Make mapset() accept a dict argument. (Ernie Rael, closes vim/vim#10295) https://github.com/vim/vim/commit/51d04d16f21e19d6eded98f9530d84089102f925 Co-authored-by: Ernie Rael --- runtime/doc/map.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 56e58baad8..6f61259af0 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -955,7 +955,7 @@ operator to add quotes around text in the current line: > \ ->setline(".")}'g@ ============================================================================== -2. Abbreviations *abbreviations* *Abbreviations* +2. Abbreviations *abbreviation* *abbreviations* *Abbreviations* Abbreviations are used in Insert mode, Replace mode and Command-line mode. If you enter a word that is an abbreviation, it is replaced with the word it -- cgit