simrat39 / symbols-outline.nvim

A tree like view for symbols in Neovim using the Language Server Protocol. Supports all your favourite languages.
MIT License
1.85k stars 100 forks source link

How do I get rid of all this wasted padding? #178

Open devkvlt opened 2 years ago

devkvlt commented 2 years ago
symbols-outline
hawkinchina commented 1 year ago

I have the same question.

tonyalaribe commented 1 year ago

Has anyone been able to figure this out?

devkvlt commented 1 year ago

@tonyalaribe For starters, set signcolumn=no for Outline filetype, but that only removes one space.

tonyalaribe commented 1 year ago

That worked nicely. Thanks @devkvlt

For others, I added this to my config:

autocmd FileType Outline setlocal signcolumn=no 
ch3n9w commented 1 year ago

to remove all the spaces, you can modify symbols-outline/parser.lua, go to M.get_lines, change line[index] = ' ' at line 119 to line[index] = '' and line[index] = line[index] .. ' ' at 167 to line[index] = line[index] .. ''.

Result: image

I hope this approach could be added into repo in a proper way, maybe we can add an option?

xlucn commented 1 year ago

I don't see the padding in other similar plugins, e.g., Tagbar, Aerial, or Vista.

It will be great if the signcolumn and hardcoded paddings are both disabled.

hedyhli commented 11 months ago

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 @ch3n9w for the suggested fix. Unfortunately, your changes would break the indents from guide markers. I've worked on top of your fix to make the guide markers look the same as they were, whilst removing the left padding.

Show diff ```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