16 lines
518 B
Lua
16 lines
518 B
Lua
local function map(mode, lhs, rhs, opts)
|
|
local keys = require("lazy.core.handler").handlers.keys
|
|
---@cast keys LazyKeysHandler
|
|
-- do not create the keymap if a lazy keys handler exists
|
|
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
|
opts = opts or {}
|
|
opts.silent = opts.silent ~= false
|
|
if opts.remap and not vim.g.vscode then
|
|
opts.remap = nil
|
|
end
|
|
vim.keymap.set(mode, lhs, rhs, opts)
|
|
end
|
|
end
|
|
|
|
map({ "i" }, "jk", "<esc>", { desc = "Remap jk to escape in insert mode" })
|