feat: Add option to disable details virtual text

Closes #32
This commit is contained in:
simrat39
2021-06-22 20:07:52 -07:00
parent a100b51b23
commit 631a8880de
3 changed files with 7 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ vim.g.symbols_outline = {
position = 'right', position = 'right',
show_numbers = false, show_numbers = false,
show_relative_numbers = false, show_relative_numbers = false,
show_symbol_details = true,
keymaps = { keymaps = {
close = "<Esc>", close = "<Esc>",
goto_location = "<Cr>", goto_location = "<Cr>",
@@ -53,6 +54,7 @@ let g:symbols_outline = {
\ "auto_preview": v:true, \ "auto_preview": v:true,
\ "show_numbers": v:false, \ "show_numbers": v:false,
\ "show_relative_numbers": v:false, \ "show_relative_numbers": v:false,
\ "show_symbol_details": v:true,
\ "keymaps": { \ "keymaps": {
\ "close": "<Esc>", \ "close": "<Esc>",
\ "goto_location": "<Cr>", \ "goto_location": "<Cr>",
@@ -73,6 +75,7 @@ let g:symbols_outline = {
| auto_preview | Show a preview of the code on hover | boolean | true | | auto_preview | Show a preview of the code on hover | boolean | true |
| show_numbers | Shows numbers with the outline | boolean | false | | show_numbers | Shows numbers with the outline | boolean | false |
| show_relative_numbers | Shows relative 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) | | keymaps | Which keys do what | table (dictionary) | [here](#default-keymaps) |
| lsp_blacklist | Which lsp clients to ignore | table (array) | {} | | lsp_blacklist | Which lsp clients to ignore | table (array) | {} |

View File

@@ -9,6 +9,7 @@ local defaults = {
auto_preview = true, auto_preview = true,
show_numbers = false, show_numbers = false,
show_relative_numbers = false, show_relative_numbers = false,
show_symbol_details = true,
keymaps = { keymaps = {
close = "<Esc>", close = "<Esc>",
goto_location = "<Cr>", goto_location = "<Cr>",

View File

@@ -1,6 +1,7 @@
local vim = vim local vim = vim
local parser = require('symbols-outline.parser') local parser = require('symbols-outline.parser')
local config = require('symbols-outline.config')
local M = {} local M = {}
@@ -20,6 +21,8 @@ end
function M.write_details(bufnr, lines) function M.write_details(bufnr, lines)
if not is_buffer_outline(bufnr) then return end 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 for index, value in ipairs(lines) do
vim.api.nvim_buf_set_virtual_text(bufnr, -1, index - 1, vim.api.nvim_buf_set_virtual_text(bufnr, -1, index - 1,
{{value, "Comment"}}, {}) {{value, "Comment"}}, {})