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