From 631a8880deccf97bfea44d02d70afc8084f49c24 Mon Sep 17 00:00:00 2001 From: simrat39 Date: Tue, 22 Jun 2021 20:07:52 -0700 Subject: [PATCH] feat: Add option to disable details virtual text Closes #32 --- README.md | 3 +++ lua/symbols-outline/config.lua | 1 + lua/symbols-outline/writer.lua | 3 +++ 3 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 437dd17..ac8f33a 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ vim.g.symbols_outline = { position = 'right', show_numbers = false, show_relative_numbers = false, + show_symbol_details = true, keymaps = { close = "", goto_location = "", @@ -53,6 +54,7 @@ let g:symbols_outline = { \ "auto_preview": v:true, \ "show_numbers": v:false, \ "show_relative_numbers": v:false, + \ "show_symbol_details": v:true, \ "keymaps": { \ "close": "", \ "goto_location": "", @@ -73,6 +75,7 @@ let g:symbols_outline = { | auto_preview | Show a preview of the code on hover | boolean | true | | show_numbers | Shows numbers with the outline | boolean | false | | show_relative_numbers | Shows relative numbers with the outline | boolean | false | +| show_symbol_details | Shows extra details with the symbols (lsp dependent) | boolean | true | | keymaps | Which keys do what | table (dictionary) | [here](#default-keymaps) | | lsp_blacklist | Which lsp clients to ignore | table (array) | {} | diff --git a/lua/symbols-outline/config.lua b/lua/symbols-outline/config.lua index 5357dea..1b5a165 100644 --- a/lua/symbols-outline/config.lua +++ b/lua/symbols-outline/config.lua @@ -9,6 +9,7 @@ local defaults = { auto_preview = true, show_numbers = false, show_relative_numbers = false, + show_symbol_details = true, keymaps = { close = "", goto_location = "", diff --git a/lua/symbols-outline/writer.lua b/lua/symbols-outline/writer.lua index b287aab..0ca1558 100644 --- a/lua/symbols-outline/writer.lua +++ b/lua/symbols-outline/writer.lua @@ -1,6 +1,7 @@ local vim = vim local parser = require('symbols-outline.parser') +local config = require('symbols-outline.config') local M = {} @@ -20,6 +21,8 @@ end function M.write_details(bufnr, lines) if not is_buffer_outline(bufnr) then return end + if not config.options.show_symbol_details then return end + for index, value in ipairs(lines) do vim.api.nvim_buf_set_virtual_text(bufnr, -1, index - 1, {{value, "Comment"}}, {})