From f98bc4de86d709de12efaa62120dc470a6968b68 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 23 Nov 2021 05:09:08 +1100 Subject: [PATCH] feat: added autoclose functionality --- doc/symbols-outline.txt | 10 ++++++++++ lua/symbols-outline.lua | 1 + lua/symbols-outline/config.lua | 1 + 3 files changed, 12 insertions(+) diff --git a/doc/symbols-outline.txt b/doc/symbols-outline.txt index a4b7f9b..1592365 100644 --- a/doc/symbols-outline.txt +++ b/doc/symbols-outline.txt @@ -49,6 +49,7 @@ or skip this section entirely if you want to roll with the defaults. auto_preview = true, position = 'right', width = 25, + auto_close = false, show_numbers = false, show_relative_numbers = false, show_symbol_details = true, @@ -132,6 +133,15 @@ width Type: int +----------------------------------------------------------------------------- +auto_close + + Whether to automatically close the window after selection + + Default: false ~ + + Type: boolean + ----------------------------------------------------------------------------- auto_preview diff --git a/lua/symbols-outline.lua b/lua/symbols-outline.lua index 5381bf6..41c1ee1 100644 --- a/lua/symbols-outline.lua +++ b/lua/symbols-outline.lua @@ -72,6 +72,7 @@ function M._goto_location(change_focus) vim.api.nvim_win_set_cursor(M.state.code_win, {node.line + 1, node.character}) if change_focus then vim.fn.win_gotoid(M.state.code_win) end + if config.options.auto_close then M.close_outline() end end function M._highlight_current_item(winnr) diff --git a/lua/symbols-outline/config.lua b/lua/symbols-outline/config.lua index e171cd0..0209fdf 100644 --- a/lua/symbols-outline/config.lua +++ b/lua/symbols-outline/config.lua @@ -7,6 +7,7 @@ M.defaults = { show_guides = true, position = 'right', width = 25, + auto_close = false, auto_preview = true, show_numbers = false, show_relative_numbers = false,