Skip to content

Commit caf015a

Browse files
committed
fix: correct mappings in README quickstart, fix navigate in buffers, fixes #212
1 parent 828a94b commit caf015a

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@ use {
130130
["s"] = "open_vsplit",
131131
["t"] = "open_tabnew",
132132
["C"] = "close_node",
133-
["<bs>"] = "navigate_up",
134-
["."] = "set_root",
135-
["H"] = "toggle_hidden",
136-
["R"] = "refresh",
137-
["/"] = "fuzzy_finder",
138-
["f"] = "filter_on_submit",
139-
["<c-x>"] = "clear_filter",
140133
["a"] = "add",
141134
["A"] = "add_directory",
142135
["d"] = "delete",
@@ -147,6 +140,7 @@ use {
147140
["c"] = "copy", -- takes text input for destination
148141
["m"] = "move", -- takes text input for destination
149142
["q"] = "close_window",
143+
["R"] = "refresh",
150144
}
151145
},
152146
nesting_rules = {},
@@ -174,12 +168,24 @@ use {
174168
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
175169
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
176170
-- instead of relying on nvim autocmd events.
171+
window = {
172+
mappings = {
173+
["<bs>"] = "navigate_up",
174+
["."] = "set_root",
175+
["H"] = "toggle_hidden",
176+
["/"] = "fuzzy_finder",
177+
["f"] = "filter_on_submit",
178+
["<c-x>"] = "clear_filter",
179+
}
180+
}
177181
},
178182
buffers = {
179183
show_unloaded = true,
180184
window = {
181185
mappings = {
182186
["bd"] = "buffer_delete",
187+
["<bs>"] = "navigate_up",
188+
["."] = "set_root",
183189
}
184190
},
185191
},
@@ -198,6 +204,7 @@ use {
198204
}
199205
}
200206
})
207+
201208
vim.cmd([[nnoremap \ :Neotree reveal<cr>]])
202209
end
203210
}

lua/neo-tree/sources/buffers/commands.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ end
6363
---Navigate up one level.
6464
M.navigate_up = function(state)
6565
local parent_path, _ = utils.split_path(state.path)
66-
buffers.navigate(parent_path)
66+
buffers.navigate(state, parent_path)
6767
end
6868

6969
M.open = cc.open
@@ -81,7 +81,7 @@ M.set_root = function(state)
8181
local tree = state.tree
8282
local node = tree:get_node()
8383
if node.type == "directory" then
84-
buffers.navigate(node.id)
84+
buffers.navigate(state, node.id)
8585
end
8686
end
8787

lua/neo-tree/sources/common/file-items.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ local utils = require("neo-tree.utils")
44
local log = require("neo-tree.log")
55
local git = require("neo-tree.git")
66

7+
local unused_to_produce_diagnostic = {}
8+
79
local function sort_items(a, b)
810
if a.type == b.type then
911
return a.path < b.path

lua/neo-tree/ui/renderer.lua

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -650,14 +650,7 @@ create_window = function(state)
650650
log.trace("Skipping mapping for %s", cmd)
651651
else
652652
if type(func) == "string" then
653-
local func_ref = state.commands[func]
654-
if func_ref then
655-
func = func_ref
656-
else
657-
log.error(
658-
string.format("Could not find command %s for mapping %s in %s", func, cmd, state.name)
659-
)
660-
end
653+
func = state.commands[func]
661654
end
662655
if type(func) == "function" then
663656
keymap.set(state.bufnr, "n", cmd, function()

0 commit comments

Comments
 (0)