feat: Goto and close keybinding
This commit is contained in:
@@ -51,6 +51,7 @@ M.defaults = {
|
|||||||
close = { '<Esc>', 'q' },
|
close = { '<Esc>', 'q' },
|
||||||
goto_location = '<Cr>',
|
goto_location = '<Cr>',
|
||||||
peek_location = 'o',
|
peek_location = 'o',
|
||||||
|
goto_and_close = '<S-Cr>',
|
||||||
restore_location = "<C-g>",
|
restore_location = "<C-g>",
|
||||||
hover_symbol = '<C-space>',
|
hover_symbol = '<C-space>',
|
||||||
toggle_preview = 'K',
|
toggle_preview = 'K',
|
||||||
|
|||||||
@@ -115,6 +115,11 @@ function M._goto_location(change_focus)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M._goto_and_close()
|
||||||
|
M.__goto_location(true)
|
||||||
|
M.close_outline()
|
||||||
|
end
|
||||||
|
|
||||||
function M._move_and_goto(direction)
|
function M._move_and_goto(direction)
|
||||||
local move = direction == 'down' and 1 or -1
|
local move = direction == 'down' and 1 or -1
|
||||||
local cur = vim.api.nvim_win_get_cursor(0)
|
local cur = vim.api.nvim_win_get_cursor(0)
|
||||||
@@ -298,9 +303,9 @@ local function setup_keymaps(bufnr)
|
|||||||
M._goto_location(false)
|
M._goto_location(false)
|
||||||
end)
|
end)
|
||||||
-- Navigate to corresponding outline location for current code location
|
-- Navigate to corresponding outline location for current code location
|
||||||
map(cfg.o.keymaps.restore_location, function()
|
map(cfg.o.keymaps.restore_location, M._map_follow_cursor)
|
||||||
M._map_follow_cursor()
|
-- Navigate to corresponding outline location for current code location
|
||||||
end)
|
map(cfg.o.keymaps.goto_and_close, M._goto_and_close)
|
||||||
-- Move down/up in outline and peek that location in code
|
-- Move down/up in outline and peek that location in code
|
||||||
map(cfg.o.keymaps.down_and_goto, function()
|
map(cfg.o.keymaps.down_and_goto, function()
|
||||||
M._move_and_goto('down')
|
M._move_and_goto('down')
|
||||||
|
|||||||
Reference in New Issue
Block a user