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)
cdc839353f

vim-patch:7b2d87220c6c

Add missing part of patch
7b2d87220c
This commit is contained in:
zeertzjq
2022-09-13 06:23:33 +08:00
committed by GitHub
parent 91a150d0a9
commit 907fc8ac37
8 changed files with 61 additions and 9 deletions

View File

@@ -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

View File

@@ -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