diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-03-13 13:28:13 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-03-13 13:28:13 +0100 |
commit | c8cdf0f80b3cfd88a4490d80572062c1fd1a96ca (patch) | |
tree | 614f36d3f295a1db8023aedc8cfb20740d7a2d50 /runtime/doc/eval.txt | |
parent | 6fd367a97c8653a2d734a38252c7d68d4b2ebaa7 (diff) |
Update runtime files.
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r-- | runtime/doc/eval.txt | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 03fcb655d5..92f020689e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.2. Last change: 2021 Feb 10 +*eval.txt* For Vim version 8.2. Last change: 2021 Mar 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5300,6 +5300,9 @@ getcharpos({expr}) Get the position for {expr}. Same as |getpos()| but the column number in the returned List is a character index instead of a byte index. + If |getpos()| returns a very large column number, such as + 2147483647, then getcharpos() will return the character index + of the last character. Example: With the cursor on '세' in line 5 with text "여보세요": > @@ -5779,6 +5782,8 @@ getpos({expr}) Get the position for {expr}. For possible values of {expr} The column number in the returned List is the byte position within the line. To get the character position in the line, use |getcharpos()| + The column number can be very large, e.g. 2147483647, in which + case it means "after the end of the line". This can be used to save and restore the position of a mark: > let save_a_mark = getpos("'a") ... @@ -7450,7 +7455,8 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) to be used when fast match additions and deletions are required, for example to highlight matching parentheses. - The list {pos} can contain one of these items: + {pos} is a list of positions. Each position can be one of + these: - A number. This whole line will be highlighted. The first line has number 1. - A list with one number, e.g., [23]. The whole line with this @@ -7463,7 +7469,7 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) - A list with three numbers, e.g., [23, 11, 3]. As above, but the third number gives the length of the highlight in bytes. - The maximum number of positions is 8. + The maximum number of positions in {pos} is 8. Example: > :highlight MyGroup ctermbg=green guibg=green @@ -7472,8 +7478,7 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) :call matchdelete(m) < Matches added by |matchaddpos()| are returned by - |getmatches()| with an entry "pos1", "pos2", etc., with the - value a list like the {pos} item. + |getmatches()|. Can also be used as a |method|: > GetGroup()->matchaddpos([23, 11]) @@ -10273,7 +10278,8 @@ str2nr({expr} [, {base} [, {quoted}]]) *str2nr()* strcharpart({src}, {start} [, {len}]) *strcharpart()* Like |strpart()| but using character index and length instead - of byte index and length. + of byte index and length. Composing characters are counted + separately. When a character index is used where a character does not exist it is assumed to be one character. For example: > strcharpart('abc', -1, 2) @@ -13142,7 +13148,7 @@ text... Cannot be followed by a comment. Examples: > :execute "buffer" nextbuf - :execute "normal" count . "w" + :execute "normal" count .. "w" < ":execute" can be used to append a command to commands that don't accept a '|'. Example: > @@ -13158,8 +13164,8 @@ text... file names. The |fnameescape()| function can be used for Vim commands, |shellescape()| for |:!| commands. Examples: > - :execute "e " . fnameescape(filename) - :execute "!ls " . shellescape(filename, 1) + :execute "e " .. fnameescape(filename) + :execute "!ls " .. shellescape(filename, 1) < Note: The executed string may be any command-line, but starting or ending "if", "while" and "for" does not |