Tips
Kerem Bozdas edited this page Apr 19, 2022
·
3 revisions
This page is for smaller "tips and tricks" that users want to share with others. This is where to put information that, while technically documented, you feel is not obvious and should be highlighted for others to find.
Discussion #249 answered by @cseickel
["<tab>"] = function(state)
state.commands["open"](state)
vim.cmd("Neotree reveal")
end,
Alternative version by @nyngwang:
['<tab>'] = function (state)
local node = state.tree:get_node()
if require("neo-tree.utils").is_expandable(node) then
state.commands["toggle_node"](state)
else
state.commands['open'](state)
vim.cmd('Neotree reveal')
end
end,
Read comment here: https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/249#discussioncomment-2585963
Discussion #163 answered by @bennypowers
["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()
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
end,