outline: Make toggling the outline the default behaviour
This commit is contained in:
@@ -12,8 +12,10 @@ function D.R(name)
|
||||
end
|
||||
|
||||
local function setupCommands()
|
||||
vim.cmd("command! " .. "SymbolsOutline " ..
|
||||
vim.cmd("command! " .. "DSymbolsOutline " ..
|
||||
":lua require'symbols-outline'.R('symbols-outline').toggle_outline()")
|
||||
vim.cmd("command! " .. "SymbolsOutline " ..
|
||||
":lua require'symbols-outline'.toggle_outline()")
|
||||
end
|
||||
|
||||
local function setup_autocmd()
|
||||
@@ -223,6 +225,7 @@ end
|
||||
local function handler(_, _, result)
|
||||
D.state.code_win = vim.api.nvim_get_current_win()
|
||||
|
||||
if D.state.outline_buf == nil then
|
||||
D.state.outline_buf = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_buf_attach(D.state.outline_buf, false,
|
||||
{on_detach = function(_, _) wipe_state() end})
|
||||
@@ -251,6 +254,9 @@ local function handler(_, _, result)
|
||||
|
||||
set_onEnter_keymap(D.state.outline_buf)
|
||||
setup_highlights()
|
||||
else
|
||||
vim.api.nvim_win_close(D.state.outline_win, true)
|
||||
end
|
||||
end
|
||||
|
||||
function D.toggle_outline()
|
||||
|
||||
Reference in New Issue
Block a user