submode.nvim icon indicating copy to clipboard operation
submode.nvim copied to clipboard

priority of mappings

Open pogyomo opened this issue 1 year ago • 1 comments

Currently there exists six type of mappings

  • native mode
    • default mappings
    • global mappings
    • buffer local mappings
  • submode
    • default mappings
    • global mappings
    • buffer local mappings

For each mode, the priority of mapping is as follow:

  • default mappings < global mappings < buffer local mappings

So, what it will be the priority between mappings of native mode and of submode?

pogyomo avatar Jun 14 '24 21:06 pogyomo

I think at least submode's one must have high priority compare to native mode's one for each type of mapping.

pogyomo avatar Jun 14 '24 21:06 pogyomo

Close. Maybe reopen in future.

pogyomo avatar Feb 10 '25 12:02 pogyomo

I believe submode.nvim should override all "native mode" keymaps. Currently, I have an issue with neo-tree because its buffer keymap takes precedence over submode's keymaps. I can't even perform an action—in my case, resizing—while focused on a window with the neo-tree buffer. This means I would have to assign keymaps for all buffers (as submode may not be activated within neo-tree buffer) and manually remove them when leaving.

In the future, someone might suggest a use case for calling buffer-specific keymaps without leaving submode, but I don't have one.

[!NOTE] If submode is active when a new buffer is added, you would also need to attach these keymaps to the buffer.

Some ideas:

  • An option like precedence_over='global'|'default'|'buffer' for a submode.
  • An option like scope='global'|'default'|'buffer' for a specific keymap.
  • Defining filetypes that will use buffer-scoped keymaps (e.g., ft=neo-tree).
  • Overriding only if keymaps are explicitly defined over default ones.
  • mini.clue style: a fuction that enables triggers for a specific buffer.

drowning-cat avatar Feb 12 '25 10:02 drowning-cat