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

21 lines
443 B
Lua

local M = {}
function M.getchar(...)
local status, ret = pcall(vim.fn.getchar, ...)
if not status then
ret = 3
end
if type(ret) == 'number' then return vim.fn.nr2char(ret) else return ret end
end
function M.getchar2nr(...)
local status, ret = pcall(vim.fn.getchar, ...)
if not status then
ret = 3
end
if type(ret) == 'number' then return ret else return vim.fn.char2nr(ret) end
end
return M