mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
feat(lua): vim.keycode (#22960)
Using nvim_replace_termcodes is too verbose, add vim.keycode for translating keycodes. Co-authored-by: ii14 <ii14@users.noreply.github.com>
This commit is contained in:
@@ -829,6 +829,20 @@ function vim.print(...)
|
||||
return ...
|
||||
end
|
||||
|
||||
--- Translate keycodes.
|
||||
---
|
||||
--- Example:
|
||||
--- <pre>lua
|
||||
--- local k = vim.keycode
|
||||
--- vim.g.mapleader = k'<bs>'
|
||||
--- </pre>
|
||||
--- @param str string String to be converted.
|
||||
--- @return string
|
||||
--- @see |nvim_replace_termcodes()|
|
||||
function vim.keycode(str)
|
||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||
end
|
||||
|
||||
function vim._cs_remote(rcid, server_addr, connect_error, args)
|
||||
local function connection_failure_errmsg(consequence)
|
||||
local explanation
|
||||
|
Reference in New Issue
Block a user