Remap leap keymappings as we exit debug mode
This commit is contained in:
parent
c353ae7e4a
commit
8a946cdf92
3 changed files with 28 additions and 17 deletions
25
nvim/lua/leap_keymap_handler.lua
Normal file
25
nvim/lua/leap_keymap_handler.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local function leap_across_windows()
|
||||||
|
require("leap").leap({
|
||||||
|
target_windows = require("leap.user").get_focusable_windows()
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function leap_in_current_buffer()
|
||||||
|
require("leap").leap({
|
||||||
|
target_windows = { vim.api.nvim_get_current_win() }
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.set_leap_keymapping()
|
||||||
|
require("utils").foreach({
|
||||||
|
{ "n", "m", leap_across_windows },
|
||||||
|
{ "v", "m", leap_in_current_buffer },
|
||||||
|
{ "o", "m", leap_in_current_buffer }
|
||||||
|
}, function(mapping)
|
||||||
|
vim.keymap.set(mapping[1], mapping[2], mapping[3])
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -1,15 +1,3 @@
|
||||||
local function leap_across_windows()
|
|
||||||
require("leap").leap({
|
|
||||||
target_windows = require("leap.user").get_focusable_windows()
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local function leap_in_current_buffer()
|
|
||||||
require("leap").leap({
|
|
||||||
target_windows = { vim.api.nvim_get_current_win() }
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local saved_hlsearch = false
|
local saved_hlsearch = false
|
||||||
local saved_highlights = {}
|
local saved_highlights = {}
|
||||||
local colors = require("ayu.colors")
|
local colors = require("ayu.colors")
|
||||||
|
|
@ -32,11 +20,6 @@ return {
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
opts = {},
|
opts = {},
|
||||||
keys = {
|
|
||||||
{ "m", function() leap_across_windows() end, mode = "n" },
|
|
||||||
{ "m", function() leap_in_current_buffer() end, mode = "v" },
|
|
||||||
{ "m", function() leap_in_current_buffer() end, mode = "o" },
|
|
||||||
},
|
|
||||||
init = function()
|
init = function()
|
||||||
local leap = require("leap")
|
local leap = require("leap")
|
||||||
|
|
||||||
|
|
@ -71,5 +54,7 @@ return {
|
||||||
for _, cmd in ipairs(autocmds) do
|
for _, cmd in ipairs(autocmds) do
|
||||||
utils.create_user_event_cb(cmd.event_name, cmd.cb, leap_augroup_name)
|
utils.create_user_event_cb(cmd.event_name, cmd.cb, leap_augroup_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require("leap_keymap_handler").set_leap_keymapping()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ return {
|
||||||
if are_stepping_keymaps_active then
|
if are_stepping_keymaps_active then
|
||||||
utils.del_keymap_list(stepping_keymaps)
|
utils.del_keymap_list(stepping_keymaps)
|
||||||
are_stepping_keymaps_active = false
|
are_stepping_keymaps_active = false
|
||||||
|
require("leap_keymap_handler").set_leap_keymapping()
|
||||||
end
|
end
|
||||||
|
|
||||||
inlay_hints_handler.restore()
|
inlay_hints_handler.restore()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue