lazy.nvim/lua/lazy/core/handler/keys.lua

25 lines
590 B
Lua
Raw Normal View History

local Util = require("lazy.core.util")
local Loader = require("lazy.core.loader")
---@class LazyKeysHandler:LazyHandler
local M = {}
---@param keys string
2022-12-16 16:13:08 +08:00
function M:_add(keys)
vim.keymap.set("n", keys, function()
vim.keymap.del("n", keys)
Util.track({ keys = keys })
2022-12-16 16:13:08 +08:00
Loader.load(self.active[keys], { keys = keys })
local feed = vim.api.nvim_replace_termcodes(keys, true, false, true)
vim.api.nvim_feedkeys(feed, "m", false)
Util.track()
end, { silent = true })
end
2022-12-16 16:13:08 +08:00
---@param keys string
function M:_del(keys)
pcall(vim.keymap.del, "n", keys)
end
return M