1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 09:20:06 +08:00
SpaceVim/lua/spacevim/api/vim/keys.lua
2022-07-10 20:51:19 +08:00

19 lines
527 B
Lua

--!/usr/bin/lua
local M = {}
function M.t(str)
if vim.api ~= nil and vim.api.nvim_replace_termcodes ~= nil then
-- https://github.com/neovim/neovim/issues/17369
local ret = vim.api.nvim_replace_termcodes(str, false, true, true):gsub("\128\254X", "\128")
return ret
else
-- local ret = vim.fn.execute('echon "\\' .. str .. '"')
-- ret = ret:gsub('<80>', '\128')
-- return ret
return vim.eval(string.format('"\\%s"', str))
end
end
return M