symbols-outline.nvim
symbols-outline.nvim copied to clipboard
How do I get rid of all this wasted padding?

I have the same question.
Has anyone been able to figure this out?
@tonyalaribe
For starters, set signcolumn=no
for Outline
filetype, but that only removes one space.
That worked nicely. Thanks @devkvlt
For others, I added this to my config:
autocmd FileType Outline setlocal signcolumn=no
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:
I hope this approach could be added into repo in a proper way, maybe we can add an option?
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.
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 --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.