mirror of https://github.com/LazyVim/starter
feat: add L and H keymap
parent
92c3626e78
commit
cad35e65c0
|
@ -74,6 +74,33 @@ return {
|
|||
opts = {
|
||||
auto_clean_after_session_restore = true,
|
||||
close_if_last_window = true,
|
||||
window = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
["h"] = function(state)
|
||||
local node = state.tree:get_node()
|
||||
if node.type == "directory" and node:is_expanded() then
|
||||
require("neo-tree.sources.filesystem").toggle_directory(state, node)
|
||||
else
|
||||
require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
|
||||
end
|
||||
end,
|
||||
["l"] = function(state)
|
||||
local node = state.tree:get_node()
|
||||
local path = node:get_id()
|
||||
if node.type == "directory" then
|
||||
if not node:is_expanded() then
|
||||
require("neo-tree.sources.filesystem").toggle_directory(state, node)
|
||||
elseif node:has_children() then
|
||||
require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
|
||||
end
|
||||
end
|
||||
if node.type == "file" then
|
||||
require("neo-tree.utils").open_file(state, path)
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue