From 7c74d1d5f509d399606b191f0590b71264c19cbd Mon Sep 17 00:00:00 2001 From: dotfrag <17456867+dotfrag@users.noreply.github.com> Date: Thu, 23 May 2024 19:15:51 +0300 Subject: [PATCH] feat(neo-tree): add h/l navigation and open file support --- lua/lazyvim/plugins/editor.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 3c98ba8e..a448a679 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -87,6 +87,26 @@ return { end, desc = "Open with System Application", }, + ["h"] = function(state) + local node = state.tree:get_node() + if node:has_children() and node:is_expanded() then + state.commands.toggle_node(state) + else + require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id()) + end + end, + ["l"] = function(state) + local node = state.tree:get_node() + if node:has_children() then + if not node:is_expanded() then + state.commands.toggle_node(state) + else + require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1]) + end + else + state.commands.open(state) + end + end, }, }, default_component_configs = {