This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/nvim/lua/key/rekey.lua

40 lines
758 B
Lua

local function rekey(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = true })
end
local function remap(t, key, command)
vim.api.nvim_set_keymap(t, key, command, { noremap = false })
end
function rekey_normal(key, command)
rekey('n', key, command)
end
function rekey_input(key, command)
rekey('i', key, command)
end
function rekey_visual(key, command)
rekey('v', key, command)
end
function rekey_terminal(key, command)
rekey('t', key, command)
end
function remap_normal(key, command)
remap('n', key, command)
end
function remap_input(key, command)
remap('i', key, command)
end
function remap_visual(key, command)
remap('v', key, command)
end
function remap_terminal(key, command)
remap('t', key, command)
end