Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

[Suggestion] Use more "standard" keymaps for opening buffers (e/s/v/t) and reserve <Cr> for actual "triggering" #32

Open
idanarye opened this issue Aug 24, 2022 · 3 comments

Comments

@idanarye
Copy link

Mind's current behavior is to open the node as a data node on <Cr>, and if it's not a data node make it a data node - unless it's already a URL node. I suggest a different behavior:

  • To open the node's data, use e/s/v/t, which are kind of a standard for filesystem tree viewers in Vim.
  • <Cr> will trigger the node type's action (should be customizable, as per my other suggestion - [Suggestion] explicit and customizable node types #31)
  • For data nodes, that action can indeed be to open the file. But for typeless nodes, I think it should be to just toggle the node.
  • Since data nodes are going to be the norm, using e/s/v/t on a typeless node will convert the node to a data node and open the file.
  • For other types of nodes, e/s/v/t can have custom meanings. For example, For URL nodes it can open a scratch buffer for editing their URL.
@hadronized
Copy link
Owner

For data nodes, that action can indeed be to open the file. But for typeless nodes, I think it should be to just toggle the node.

It’s a bit more complex than that, since parent node can also have data.

For the rest, I think we could indeed add a couple of keybindings to open in different kind of split, indeed.

@idanarye
Copy link
Author

<Tab> will still toggle nodes, of course. But if a node has no data, <Cr> will toggle it instead of adding data to it.

Another option is to have <Cr> open a vim.ui.select and let the user choose the node type.

@hadronized
Copy link
Owner

Yeah, the prompt idea is a good one, tracked from another issue as well. For the rest of your issue, that could open too, I need to investigate the keybindings a bit and refactor the code so that it’s easier to implement all of those – it’s basically just a different command to pass when the file is created; it shouldn’t be a big deal.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants