dotfiles/.config/nvim/lua/config/keymaps.lua

16 lines
518 B
Lua
Raw Normal View History

2024-03-30 16:15:31 +00:00
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" })