aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-13 06:23:33 +0800
committerGitHub <noreply@github.com>2022-09-13 06:23:33 +0800
commit907fc8ac373226556b84c2fdc4fe26525bbdb2c4 (patch)
tree42fc5a92284c1b52c0fbdda07964245dee57edf5 /runtime
parent91a150d0a9f81d8db34ba45de2a8a270010e2f3a (diff)
downloadrneovim-907fc8ac373226556b84c2fdc4fe26525bbdb2c4.tar.gz
rneovim-907fc8ac373226556b84c2fdc4fe26525bbdb2c4.tar.bz2
rneovim-907fc8ac373226556b84c2fdc4fe26525bbdb2c4.zip
vim-patch:9.0.0449: there is no easy way to translate a key code into a string (#20168)
Problem: There is no easy way to translate a string with a key code into a readable string. Solution: Add the keytrans() function. (closes vim/vim#11114) https://github.com/vim/vim/commit/cdc839353f68ca43db6446e1b727fc7ba657b738 vim-patch:7b2d87220c6c Add missing part of patch https://github.com/vim/vim/commit/7b2d87220c6c974d5cdae672b6f9620a6bcbd1dc
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/builtin.txt12
-rw-r--r--runtime/doc/usr_41.txt2
2 files changed, 14 insertions, 0 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index c70643d12c..7b1a50c1fb 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -277,6 +277,8 @@ join({list} [, {sep}]) String join {list} items into one String
json_decode({expr}) any Convert {expr} from JSON
json_encode({expr}) String Convert {expr} to 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
@@ -4537,6 +4539,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
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index ee644be366..1aa9aaa0c4 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -604,6 +604,8 @@ String manipulation: *string-functions*
fnameescape() escape a file name for use with a Vim command
tr() translate characters from one set to another
strtrans() translate a string to make it printable
+ keytrans() translate internal keycodes to a form that
+ can be used by |:map|
tolower() turn a string to lowercase
toupper() turn a string to uppercase
charclass() class of a character