Mercurial > vim
comparison runtime/doc/builtin.txt @ 29024:9f25e0ed831d v8.2.5034
patch 8.2.5034: there is no way to get the byte index from a virtual column
Commit: https://github.com/vim/vim/commit/5a6ec10cc80ab02eeff644ab19b82312630ea855
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 27 21:58:00 2022 +0100
patch 8.2.5034: there is no way to get the byte index from a virtual column
Problem: There is no way to get the byte index from a virtual column.
Solution: Add virtcol2col(). (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/10477,
closes #10098)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 27 May 2022 23:00:03 +0200 |
parents | aadeddf38d9b |
children | f8e9d5023bf6 |
comparison
equal
deleted
inserted
replaced
29023:b7960e26a397 | 29024:9f25e0ed831d |
---|---|
689 uniq({list} [, {func} [, {dict}]]) | 689 uniq({list} [, {func} [, {dict}]]) |
690 List remove adjacent duplicates from a list | 690 List remove adjacent duplicates from a list |
691 values({dict}) List values in {dict} | 691 values({dict}) List values in {dict} |
692 virtcol({expr} [, {list}]) Number or List | 692 virtcol({expr} [, {list}]) Number or List |
693 screen column of cursor or mark | 693 screen column of cursor or mark |
694 virtcol2col({winid}, {lnum}, {col}) | |
695 Number byte index of a character on screen | |
694 visualmode([expr]) String last visual mode used | 696 visualmode([expr]) String last visual mode used |
695 wildmenumode() Number whether 'wildmenu' mode is active | 697 wildmenumode() Number whether 'wildmenu' mode is active |
696 win_execute({id}, {command} [, {silent}]) | 698 win_execute({id}, {command} [, {silent}]) |
697 String execute {command} in window {id} | 699 String execute {command} in window {id} |
698 win_findbuf({bufnr}) List find windows containing {bufnr} | 700 win_findbuf({bufnr}) List find windows containing {bufnr} |
6209 GetNumber()->nr2char() | 6211 GetNumber()->nr2char() |
6210 | 6212 |
6211 or({expr}, {expr}) *or()* | 6213 or({expr}, {expr}) *or()* |
6212 Bitwise OR on the two arguments. The arguments are converted | 6214 Bitwise OR on the two arguments. The arguments are converted |
6213 to a number. A List, Dict or Float argument causes an error. | 6215 to a number. A List, Dict or Float argument causes an error. |
6216 Also see `and()` and `xor()`. | |
6214 Example: > | 6217 Example: > |
6215 :let bits = or(bits, 0x80) | 6218 :let bits = or(bits, 0x80) |
6216 < Can also be used as a |method|: > | 6219 < Can also be used as a |method|: > |
6217 :let bits = bits->or(0x80) | 6220 :let bits = bits->or(0x80) |
6221 | |
6222 < Rationale: The reason this is a function and not using the "|" | |
6223 character like many languages, is that Vi has always used "|" | |
6224 to separate commands. In many places it would not be clear if | |
6225 "|" is an operator or a command separator. | |
6218 | 6226 |
6219 | 6227 |
6220 pathshorten({path} [, {len}]) *pathshorten()* | 6228 pathshorten({path} [, {len}]) *pathshorten()* |
6221 Shorten directory names in the path {path} and return the | 6229 Shorten directory names in the path {path} and return the |
6222 result. The tail, the file name, is kept as-is. The other | 6230 result. The tail, the file name, is kept as-is. The other |
9786 echo max(map(range(1, line('$')), "virtcol([v:val, '$'])")) | 9794 echo max(map(range(1, line('$')), "virtcol([v:val, '$'])")) |
9787 | 9795 |
9788 < Can also be used as a |method|: > | 9796 < Can also be used as a |method|: > |
9789 GetPos()->virtcol() | 9797 GetPos()->virtcol() |
9790 | 9798 |
9799 virtcol2col({winid}, {lnum}, {col}) *virtcol2col()* | |
9800 The result is a Number, which is the byte index of the | |
9801 character in window {winid} at buffer line {lnum} and virtual | |
9802 column {col}. | |
9803 | |
9804 If {col} is greater than the last virtual column in line | |
9805 {lnum}, then the byte index of the character at the last | |
9806 virtual column is returned. | |
9807 | |
9808 The {winid} argument can be the window number or the | |
9809 |window-ID|. If this is zero, then the current window is used. | |
9810 | |
9811 Returns -1 if the window {winid} doesn't exist or the buffer | |
9812 line {lnum} or virtual column {col} is invalid. | |
9813 | |
9814 See also |screenpos()|, |virtcol()| and |col()|. | |
9815 | |
9816 Can also be used as a |method|: > | |
9817 GetWinid()->virtcol2col(lnum, col) | |
9791 | 9818 |
9792 visualmode([{expr}]) *visualmode()* | 9819 visualmode([{expr}]) *visualmode()* |
9793 The result is a String, which describes the last Visual mode | 9820 The result is a String, which describes the last Visual mode |
9794 used in the current buffer. Initially it returns an empty | 9821 used in the current buffer. Initially it returns an empty |
9795 string, but once Visual mode has been used, it returns "v", | 9822 string, but once Visual mode has been used, it returns "v", |
10218 | 10245 |
10219 | 10246 |
10220 xor({expr}, {expr}) *xor()* | 10247 xor({expr}, {expr}) *xor()* |
10221 Bitwise XOR on the two arguments. The arguments are converted | 10248 Bitwise XOR on the two arguments. The arguments are converted |
10222 to a number. A List, Dict or Float argument causes an error. | 10249 to a number. A List, Dict or Float argument causes an error. |
10250 Also see `and()` and `or()`. | |
10223 Example: > | 10251 Example: > |
10224 :let bits = xor(bits, 0x80) | 10252 :let bits = xor(bits, 0x80) |
10225 < | 10253 < |
10226 Can also be used as a |method|: > | 10254 Can also be used as a |method|: > |
10227 :let bits = bits->xor(0x80) | 10255 :let bits = bits->xor(0x80) |