Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

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

Open
zjp-CN opened this issue Sep 13, 2022 · 5 comments
Open

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

zjp-CN opened this issue Sep 13, 2022 · 5 comments

Comments

@zjp-CN
Copy link

zjp-CN commented Sep 13, 2022

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!

@tonyalaribe
Copy link

I've been searching for this too.

@hawkinchina
Copy link

me too.

@Davincible
Copy link

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,
})

@sudoCompetence
Copy link

sudoCompetence commented Sep 14, 2023

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,
});

@hedyhli
Copy link

hedyhli commented Nov 8, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants