From 0769cfe5c36123184a714fcf3fc980e2da323cb7 Mon Sep 17 00:00:00 2001 From: hedy Date: Wed, 1 Nov 2023 16:20:51 +0800 Subject: [PATCH] feat(cursorline): Add cursorline option --- README.md | 8 ++++++++ lua/symbols-outline/config.lua | 1 + lua/symbols-outline/preview.lua | 1 + lua/symbols-outline/view.lua | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 832cf68..f3f1451 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ keep this list up to date. (simrat39/symbols-outline.nvim#194) - Feat: when `auto_close=true` only auto close if `goto_location` is used (where focus changed), and not for `focus_location` (simrat39/symbols-outline.nvim#119) +- Feat: Cursorline option for the outline window - Fix symbol preview (simrat39/symbols-outline.nvim#176) - Fix `SymbolsOutlineClose` crashing when already closed: simrat39/symbols-outline.nvim#163 @@ -133,6 +134,12 @@ Items will be moved to above list when complete. - Go to parent - Cycle siblings +- [ ] simrat39/symbols-outline.nvim#75: Handling of the outline window when attached + buffer is closed. + + Maybe it should continue working, so that pressing enter can open a split to + the correct location, and pressing `q` can properly close the buffer. + ### Related plugins - nvim-navic @@ -225,6 +232,7 @@ local opts = { auto_close = false, show_numbers = false, show_relative_numbers = false, + show_cursorline = true, show_symbol_details = true, preview_bg_highlight = 'Pmenu', autofold_depth = nil, diff --git a/lua/symbols-outline/config.lua b/lua/symbols-outline/config.lua index 057136e..fa30255 100644 --- a/lua/symbols-outline/config.lua +++ b/lua/symbols-outline/config.lua @@ -13,6 +13,7 @@ M.defaults = { auto_preview = false, show_numbers = false, show_relative_numbers = false, + show_cursorline = true, show_symbol_details = true, preview_bg_highlight = 'Pmenu', winblend = 0, diff --git a/lua/symbols-outline/preview.lua b/lua/symbols-outline/preview.lua index fdf4671..50a886f 100644 --- a/lua/symbols-outline/preview.lua +++ b/lua/symbols-outline/preview.lua @@ -117,6 +117,7 @@ local function update_hover() provider.hover_info(params.bufnr, params, function(err, result) if err then print(vim.inspect(err)) + return end local markdown_lines = {} if result ~= nil then diff --git a/lua/symbols-outline/view.lua b/lua/symbols-outline/view.lua index 646b909..b4d1abb 100644 --- a/lua/symbols-outline/view.lua +++ b/lua/symbols-outline/view.lua @@ -49,6 +49,10 @@ function View:setup_view() if config.options.show_relative_numbers then vim.api.nvim_win_set_option(self.winnr, 'rnu', true) end + + if config.options.show_cursorline then + vim.api.nvim_win_set_option(self.winnr, 'cursorline', true) + end end function View:close()