feat(commands): quick jump#2004
Conversation
pynappo
left a comment
There was a problem hiding this comment.
Cool idea. not totally sure if it has to be in neo-tree but will suggest improvements nonetheless
|
Thanks a lot for your helpful advice, especially for someone new to plugin development :-) I had barely considered customizability, but this part has been added into the code in the newest commit. Now it is possible to write different post-jump callback for each sources, as well as jump labels. Rendering is also a point. Most jump plugins attends to overlap its hotkeys among the original word, and it is sometimes inconvenient that I cannot read the filename. Replacing the icon was easily implemented internally, and it perfectly solved this problem. |
|
Also, hotkeys will no longer be exhausted now. |
| ---@param ch string | ||
| ---@param depth integer | ||
| ---@return table<neotree.FileNode, string> candidate | ||
| M.get_candidate = function(node2key, ch, depth) |
There was a problem hiding this comment.
These seem too highly specific to belong to utils. I would keep all of these functions in sources/common/commands.lua or somewhere like sources/common/lib/jump.lua if you want a separate file
There was a problem hiding this comment.
Perhaps a separate file is better, as commands is long enough now and these helpers also are not used anywhere else.
on_jump: Now it is possible to use the on_jump field in the config to set a custom post-jump callback for each source. jump_labels: Hotkeys will generated according to the priority of the jump labels in the config. Hotkeys will no longer be exhausted.
Use node as keys in the node-name mapping to avoid name collisions.
Co-authored-by: pynappo <lehtien.david@gmail.com>
Command
quick_jumpcan dynamically compute, assign and render hotkeys for jumping to a specific node, while also monitoring key inputs to handle jump/toggle/cancel actions.A default leader key for this function
;has been added indefaults.luanow, but no description has been written in doc.When neo-tree is focused, pressing
;re-renders all icons and displays maps that can be used to jump to/toggle nodes.Besides, it is possible to bind this action to a global hotkey, for example:
This searches for neo-tree window, focuses it, then triggers the function.
It may be helpful to embed it as actions (like focus, show).