Skip to content

Commit 3421936

Browse files
committed
fix: fixes #87, do not warn about mapping to "none"
1 parent 97a4d95 commit 3421936

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

lua/neo-tree/ui/renderer.lua

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -435,19 +435,30 @@ local create_window = function(state)
435435
win:unmount()
436436
end, { once = true })
437437

438+
local skip_this_mapping = {
439+
["none"] = true,
440+
["nop"] = true,
441+
["noop"] = true,
442+
[""] = true,
443+
[{}] = true,
444+
}
438445
local map_options = { noremap = true, nowait = true }
439446
local mappings = utils.get_value(state, "window.mappings", {}, true)
440447
for cmd, func in pairs(mappings) do
441448
if func then
442-
if type(func) == "string" then
443-
func = state.commands[func]
444-
end
445-
if type(func) == "function" then
446-
win:map("n", cmd, function()
447-
func(state)
448-
end, map_options)
449+
if skip_this_mapping[func] then
450+
log.trace("Skipping mapping for %s", cmd)
449451
else
450-
log.warn("Invalid mapping for %s: %s", cmd, func)
452+
if type(func) == "string" then
453+
func = state.commands[func]
454+
end
455+
if type(func) == "function" then
456+
win:map("n", cmd, function()
457+
func(state)
458+
end, map_options)
459+
else
460+
log.warn("Invalid mapping for ", cmd, ": ", func)
461+
end
451462
end
452463
end
453464
end

0 commit comments

Comments
 (0)