symbols-outline.nvim icon indicating copy to clipboard operation
symbols-outline.nvim copied to clipboard

How to eliminate the indent (two spaces) on the left side?

Open zjp-CN opened this issue 2 years ago • 5 comments

require "symbols-outline".setup {
  fold_markers = { '▶', '▽' },
  width = 35,
  symbols = {
    File = { icon = "File", hl = "TSURI" },
    Module = { icon = "Mod", hl = "TSNamespace" },
    Namespace = { icon = "Name", hl = "TSNamespace" },
    Package = { icon = "Pack", hl = "TSNamespace" },
    Class = { icon = "Class", hl = "TSType" },
    Method = { icon = "ƒ", hl = "TSMethod" },
    Property = { icon = "Property", hl = "TSMethod" },
    Field = { icon = "Field", hl = "TSField" },
    Constructor = { icon = "Constructor", hl = "TSConstructor" },
    Enum = { icon = "Enum", hl = "TSType" },
    Interface = { icon = "Interface", hl = "TSType" },
    Function = { icon = "f", hl = "TSFunction" },
    Variable = { icon = "var", hl = "TSConstant" },
    Constant = { icon = "const", hl = "TSConstant" },
    String = { icon = "string", hl = "TSString" },
    Number = { icon = "#", hl = "TSNumber" },
    Boolean = { icon = "bool", hl = "TSBoolean" },
    Array = { icon = "[]", hl = "TSConstant" },
    Object = { icon = "obj", hl = "TSType" },
    Key = { icon = "key", hl = "TSType" },
    Null = { icon = "NULL", hl = "TSType" },
    EnumMember = { icon = "variant", hl = "TSField" },
    Struct = { icon = "struct", hl = "TSType" },
    Event = { icon = "event", hl = "TSType" },
    Operator = { icon = "op", hl = "TSOperator" },
    TypeParameter = { icon = "T", hl = "TSParameter" }
  }
}

image

BTW This is a great tool!

zjp-CN avatar Sep 13 '22 15:09 zjp-CN

I've been searching for this too.

tonyalaribe avatar Sep 16 '22 15:09 tonyalaribe

me too.

hawkinchina avatar Oct 14 '22 02:10 hawkinchina

Doesn't remove the space, but this also made the margin smaller for me

local _ft = vim.api.nvim_create_augroup("FileTypeSettings", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
	pattern = "Outline",
	callback = function()
		vim.wo.signcolumn = "no"
	end,
	group = _ft,
})

Davincible avatar Oct 22 '22 21:10 Davincible

Doesn't remove the space, but this also made the margin smaller for me

local _ft = vim.api.nvim_create_augroup("FileTypeSettings", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
	pattern = "Outline",
	callback = function()
		vim.wo.signcolumn = "no"
	end,
	group = _ft,
})

For those looking for a fix - it involves the fold column size I believe. Try this.

local _ft = vim.api.nvim_create_augroup("FileTypeSettings", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
    pattern = "Outline",
    callback = function()
        vim.wo.signcolumn = "no"
        vim.wo.foldcolumn = "0" -- '0' is not bad
    end,
    group = _ft,
});

sudoCompetence avatar Sep 14 '23 00:09 sudoCompetence

Hi everyone,

Unfortunately, it seems like simrat39 isn't very active in this plugin lately, so a few days ago I've decided to fork the repo to implement a lot of features people have asked for and fixes users reported from this repo.

Thanks @sudoCompetence for the suggested fix. Unfortunately, to completely remove the extra padding, we have to do more than the window settings. This is due to symbols-outline guide markers. Below is the diff which for me, can fix this issue.

Show diff
diff --git a/lua/symbols-outline/parser.lua b/lua/symbols-outline/parser.lua
index d1945fb..e0088ed 100644
--- a/lua/symbols-outline/parser.lua
+++ b/lua/symbols-outline/parser.lua
@@ -118,12 +118,10 @@ function M.get_lines(flattened_outline_items)
     end
 
     for index, _ in ipairs(line) do
       -- all items start with a space (or two)
       if config.options.guides.enabled then
         -- makes the guides and add guide markers
         local guide_markers = config.options.guides.markers
         if index == 1 then
-          line[index] = ' '
+          line[index] = ''
           -- if index is last, add a bottom marker if current item is last,
           -- else add a middle marker
         elseif index == #line then
@@ -177,6 +175,7 @@ function M.get_lines(flattened_outline_items)
       running_length = running_length + vim.fn.strlen(line[index])
     end
 
+    line[1] = ''
     local final_prefix = line
 
     local string_prefix = t_utils.table_to_str(final_prefix)

I've recently pushed this fix to my fork.

You are welcome to try it out but do note that some new features may be experimental (unstable). These along with other fixes are listed in the readme.

image

hedyhli avatar Nov 08 '23 00:11 hedyhli