summaryrefslogtreecommitdiffstats
path: root/runtime/doc/builtin.txt
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-12 13:38:41 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-12 13:38:41 +0100
commitcdc839353f68ca43db6446e1b727fc7ba657b738 (patch)
tree0729860faa774e594b183ce0823ae23776b92701 /runtime/doc/builtin.txt
parent5a4eb55122e45444d3a6c56ce108ce29bc8e52ab (diff)
patch 9.0.0449: there is no easy way to translate a key code into a stringv9.0.0449
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)
Diffstat (limited to 'runtime/doc/builtin.txt')
-rw-r--r--runtime/doc/builtin.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 3448ed5855..fb8b116010 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -325,6 +325,8 @@ js_encode({expr}) String encode JS style JSON
json_decode({string}) any decode JSON
json_encode({expr}) String encode JSON
keys({dict}) List keys in {dict}
+keytrans({string}) String translate internal keycodes to a form
+ that can be used by |:map|
len({expr}) Number the length of {expr}
libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
libcallnr({lib}, {func}, {arg}) Number idem, but return a Number
@@ -5205,6 +5207,16 @@ keys({dict}) *keys()*
Can also be used as a |method|: >
mydict->keys()
+keytrans({string}) *keytrans()*
+ Turn the internal byte representation of keys into a form that
+ can be used for |:map|. E.g. >
+ :let xx = "\<C-Home>"
+ :echo keytrans(xx)
+< <C-Home>
+
+ Can also be used as a |method|: >
+ "\<C-Home>"->keytrans()
+
< *len()* *E701*
len({expr}) The result is a Number, which is the length of the argument.
When {expr} is a String or a Number the length in bytes is