outline: Add Escape keymap to close window
This commit is contained in:
@@ -216,10 +216,15 @@ function D._highlight_current_item()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_onEnter_keymap(bufnr)
|
local function setup_keymaps(bufnr)
|
||||||
|
-- goto_location of symbol
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Cr>",
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Cr>",
|
||||||
":lua require('symbols-outline').goto_location()<Cr>",
|
":lua require('symbols-outline').goto_location()<Cr>",
|
||||||
{})
|
{})
|
||||||
|
-- close outline when escape is pressed
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Esc>",
|
||||||
|
":bw!<Cr>",
|
||||||
|
{})
|
||||||
end
|
end
|
||||||
|
|
||||||
local function handler(_, _, result)
|
local function handler(_, _, result)
|
||||||
@@ -252,7 +257,7 @@ local function handler(_, _, result)
|
|||||||
D.state.outline_win)
|
D.state.outline_win)
|
||||||
write_details(D.state.outline_buf, details)
|
write_details(D.state.outline_buf, details)
|
||||||
|
|
||||||
set_onEnter_keymap(D.state.outline_buf)
|
setup_keymaps(D.state.outline_buf)
|
||||||
setup_highlights()
|
setup_highlights()
|
||||||
else
|
else
|
||||||
vim.api.nvim_win_close(D.state.outline_win, true)
|
vim.api.nvim_win_close(D.state.outline_win, true)
|
||||||
|
|||||||
Reference in New Issue
Block a user