Skip to content

Commit cb3d5bd

Browse files
committed
WIP
1 parent 5cd8662 commit cb3d5bd

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

lua/neo-tree/command/parser.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ local M = {
88
}
99

1010
M.setup = function (all_source_names)
11-
print("all_source_names", vim.inspect(all_source_names))
1211
local source_names = utils.table_copy(all_source_names)
1312
table.insert(source_names, "migrations")
1413

@@ -156,6 +155,7 @@ local parse_arg = function(result, arg)
156155
end
157156

158157
M.parse = function(args, strict_checking)
158+
require("neo-tree").ensure_config()
159159
local result = {}
160160

161161
if type(args) == "string" then

lua/neo-tree/defaults.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ local config = {
115115
highlight = "NeoTreeFileIcon"
116116
},
117117
modified = {
118-
symbol = "[+]",
118+
symbol = "[+] ",
119119
highlight = "NeoTreeModified",
120120
},
121121
name = {
@@ -148,7 +148,7 @@ local config = {
148148
{
149149
"container",
150150
width = "100%",
151-
right_padding = 1,
151+
right_padding = 0,
152152
--max_width = 60,
153153
content = {
154154
{ "name", zindex = 10 },
@@ -168,7 +168,7 @@ local config = {
168168
{
169169
"container",
170170
width = "100%",
171-
right_padding = 1,
171+
right_padding = 0,
172172
--max_width = 60,
173173
content = {
174174
{

lua/neo-tree/setup/init.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,14 @@ M.merge_config = function(user_config, is_auto_config)
434434
require("neo-tree.command.parser").setup(all_source_names)
435435

436436
for source_name, mod_root in pairs(all_sources) do
437+
local module = require(mod_root)
437438
default_config[source_name] = default_config[source_name] or {
438439
renderers = {},
439440
components = {},
440441
}
441442
local source_default_config = default_config[source_name]
442-
source_default_config.components = require(mod_root .. ".components")
443-
source_default_config.commands = require(mod_root .. ".commands")
443+
source_default_config.components = module.components or require(mod_root .. ".components")
444+
source_default_config.commands = module.commands or require(mod_root .. ".commands")
444445
source_default_config.name = source_name
445446

446447
if user_config.use_default_mappings == false then

lua/neo-tree/sources/common/components.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,10 @@ end
270270

271271
M.modified = function(config, node, state)
272272
local modified_buffers = state.modified_buffers or {}
273+
273274
if modified_buffers[node.path] then
274275
return {
275-
text = (config.symbol or "[+] "),
276+
text = (make_two_char(config.symbol) or "[+] "),
276277
highlight = config.highlight or highlights.MODIFIED,
277278
}
278279
else

lua/neo-tree/sources/manager.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ end
411411
---@param callback function Callback to call after the items are loaded.
412412
---@param async boolean Whether to load the items asynchronously, may not be respected by all sources.
413413
M.navigate = function(state_or_source_name, path, path_to_reveal, callback, async)
414+
require("neo-tree").ensure_config()
414415
local state, source_name
415416
if type(state_or_source_name) == "string" then
416417
state = M.get_state(state_or_source_name)
@@ -422,7 +423,11 @@ M.navigate = function(state_or_source_name, path, path_to_reveal, callback, asyn
422423
log.error("navigate: state_or_source_name must be a string or a table")
423424
end
424425
log.trace("navigate", source_name, path, path_to_reveal)
425-
get_source_data(source_name).module.navigate(state, path, path_to_reveal, callback, async)
426+
local mod = get_source_data(source_name).module
427+
if not mod then
428+
mod = require("neo-tree.sources." .. source_name)
429+
end
430+
mod.navigate(state, path, path_to_reveal, callback, async)
426431
end
427432

428433
---Redraws the tree without scanning the filesystem again. Use this after

0 commit comments

Comments
 (0)