Merge branch 'Open-and-Close-Commands' of https://github.com/Oliver-Leete/symbols-outline.nvim into Oliver-Leete-Open-and-Close-Commands
This commit is contained in:
@@ -10,6 +10,10 @@ local M = {}
|
||||
local function setup_commands()
|
||||
vim.cmd("command! " .. "SymbolsOutline " ..
|
||||
":lua require'symbols-outline'.toggle_outline()")
|
||||
vim.cmd("command! " .. "SymbolsOutlineOpen " ..
|
||||
":lua require'symbols-outline'.open_outline()")
|
||||
vim.cmd("command! " .. "SymbolsOutlineClose " ..
|
||||
":lua require'symbols-outline'.close_outline()")
|
||||
end
|
||||
|
||||
local function setup_autocmd()
|
||||
@@ -191,6 +195,19 @@ function M.toggle_outline()
|
||||
end
|
||||
end
|
||||
|
||||
function M.open_outline()
|
||||
if M.state.outline_buf == nil then
|
||||
vim.lsp.buf_request(0, "textDocument/documentSymbol", getParams(),
|
||||
handler)
|
||||
end
|
||||
end
|
||||
|
||||
function M.close_outline()
|
||||
if M.state.outline_buf ~= nil then
|
||||
vim.api.nvim_win_close(M.state.outline_win, true)
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(opts)
|
||||
config.setup(opts)
|
||||
setup_commands()
|
||||
|
||||
@@ -13,6 +13,10 @@ end
|
||||
function D.setup_commands()
|
||||
vim.cmd("command! " .. "DSymbolsOutline " ..
|
||||
":lua require'symbols-outline.debug'.R('symbols-outline').toggle_outline()")
|
||||
vim.cmd("command! " .. "DSymbolsOutlineOpen " ..
|
||||
":lua require'symbols-outline.debug'.R('symbols-outline').open_outline()")
|
||||
vim.cmd("command! " .. "DSymbolsOutlineClose " ..
|
||||
":lua require'symbols-outline.debug'.R('symbols-outline').close_outline()")
|
||||
end
|
||||
|
||||
return D
|
||||
|
||||
Reference in New Issue
Block a user