feat manage script
This commit is contained in:
35
config/linux-dev/nvim/lua/utils/remap.lua
Normal file
35
config/linux-dev/nvim/lua/utils/remap.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local M = {}
|
||||
|
||||
function M.map(mode, lhs, rhs, opts)
|
||||
local options = { silent = true, noremap = true }
|
||||
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
|
||||
if type(mode) == "table" then
|
||||
for _, m in ipairs(mode) do
|
||||
vim.keymap.set(m, lhs, rhs, options)
|
||||
end
|
||||
else
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
end
|
||||
end
|
||||
|
||||
function M.nmap(lhs, rhs, opts)
|
||||
M.map("n", lhs, rhs, opts)
|
||||
end
|
||||
|
||||
function M.imap(lhs, rhs, opts)
|
||||
M.map("i", lhs, rhs, opts)
|
||||
end
|
||||
|
||||
function M.vmap(lhs, rhs, opts)
|
||||
M.map("v", lhs, rhs, opts)
|
||||
end
|
||||
|
||||
function M.tmap(lhs, rhs, opts)
|
||||
M.map("t", lhs, rhs, opts)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user