Skip to content

feat: configurable indent marker level #1570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ use {
},
indent = {
indent_size = 2,
level = 2,
padding = 1, -- extra padding on left hand side
-- indent guides
with_markers = true,
Expand Down
1 change: 1 addition & 0 deletions doc/neo-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ for each source, or just do it once in the default_component_configs section:
indent_marker = "│",
last_indent_marker = "└",
indent_size = 2,
level = 2
},
},
})
Expand Down
7 changes: 4 additions & 3 deletions lua/neo-tree/sources/common/components.lua
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ M.indent = function(config, node, state)
local skip_marker = state.skip_marker_at_level
local indent_size = config.indent_size or 2
local padding = config.padding or 0
local start_level = config.level or 2
local level = node.level
local with_markers = config.with_markers
local with_expanders = config.with_expanders == nil and file_nesting.is_enabled()
Expand All @@ -403,7 +404,7 @@ M.indent = function(config, node, state)
end
end

if indent_size == 0 or level < 2 or not with_markers then
if indent_size == 0 or level < start_level or not with_markers then
local len = indent_size * level + padding
local expander = get_expander()
if level == 0 or not expander then
Expand All @@ -426,12 +427,12 @@ M.indent = function(config, node, state)
table.insert(indent, { text = string.rep(" ", padding) })
end

for i = 1, level do
for i = start_level - 1, level do
local char = ""
local spaces_count = indent_size
local highlight = nil

if i > 1 and not skip_marker[i] or i == level then
if i > start_level - 1 and not skip_marker[i] or i == level then
spaces_count = spaces_count - 1
char = indent_marker
highlight = marker_highlight
Expand Down
Loading