comparison runtime/doc/builtin.txt @ 30226:b6b803ed4a53 v9.0.0449

patch 9.0.0449: there is no easy way to translate a key code into a string Commit: https://github.com/vim/vim/commit/cdc839353f68ca43db6446e1b727fc7ba657b738 Author: zeertzjq <zeertzjq@outlook.com> Date: Mon Sep 12 13:38:41 2022 +0100 patch 9.0.0449: there is no easy way to translate a key code into a string Problem: There is no easy way to translate a string with a key code into a readable string. Solution: Add the keytrans() function. (closes #11114)
author Bram Moolenaar <Bram@vim.org>
date Mon, 12 Sep 2022 14:45:04 +0200
parents fee9eccee266
children 121d28008c14
comparison
equal deleted inserted replaced
30225:51f58c2d23fa 30226:b6b803ed4a53
323 js_decode({string}) any decode JS style JSON 323 js_decode({string}) any decode JS style JSON
324 js_encode({expr}) String encode JS style JSON 324 js_encode({expr}) String encode JS style JSON
325 json_decode({string}) any decode JSON 325 json_decode({string}) any decode JSON
326 json_encode({expr}) String encode JSON 326 json_encode({expr}) String encode JSON
327 keys({dict}) List keys in {dict} 327 keys({dict}) List keys in {dict}
328 keytrans({string}) String translate internal keycodes to a form
329 that can be used by |:map|
328 len({expr}) Number the length of {expr} 330 len({expr}) Number the length of {expr}
329 libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg} 331 libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
330 libcallnr({lib}, {func}, {arg}) Number idem, but return a Number 332 libcallnr({lib}, {func}, {arg}) Number idem, but return a Number
331 line({expr} [, {winid}]) Number line nr of cursor, last line or mark 333 line({expr} [, {winid}]) Number line nr of cursor, last line or mark
332 line2byte({lnum}) Number byte count of line {lnum} 334 line2byte({lnum}) Number byte count of line {lnum}
5203 arbitrary order. Also see |items()| and |values()|. 5205 arbitrary order. Also see |items()| and |values()|.
5204 5206
5205 Can also be used as a |method|: > 5207 Can also be used as a |method|: >
5206 mydict->keys() 5208 mydict->keys()
5207 5209
5210 keytrans({string}) *keytrans()*
5211 Turn the internal byte representation of keys into a form that
5212 can be used for |:map|. E.g. >
5213 :let xx = "\<C-Home>"
5214 :echo keytrans(xx)
5215 < <C-Home>
5216
5217 Can also be used as a |method|: >
5218 "\<C-Home>"->keytrans()
5219
5208 < *len()* *E701* 5220 < *len()* *E701*
5209 len({expr}) The result is a Number, which is the length of the argument. 5221 len({expr}) The result is a Number, which is the length of the argument.
5210 When {expr} is a String or a Number the length in bytes is 5222 When {expr} is a String or a Number the length in bytes is
5211 used, as with |strlen()|. 5223 used, as with |strlen()|.
5212 When {expr} is a |List| the number of items in the |List| is 5224 When {expr} is a |List| the number of items in the |List| is