Skip to content

[FEATURE] Intercept Vim-triggered newlines for the Matrix environment \\ shortcut #352

Open
@llakala

Description

@llakala

Description of the Problem

Currently, within a Matrix environment, a \\ symbol is inserted whenever you press Enter. However, if you have have Obsidian's Vim mode enabled, and press o to add a newline and enter Insert mode, no \\ is added.

Description of the Solution

Hypothetically, the plugin would be able to detect the Vim action and add \\ when pressing o, just like when pressing Enter normally.

I don't know if this is possible. If the newline isn't being detected by KeyboardEvent, I assume that Obsidian's does something like this when pressing o:

  1. add the newline through its own systems, undetectable to us
  2. enter Insert mode, where we can now detect inputs (but a bit late for that)

If it is possible to hook into this mechanism, it's not obvious to me how one would do it. I originally planned on making a PR to implement this, but realized I didn't know what direction to go in. I'd love some feedback on whether people think this would be possible, and if so, how it could be implemented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions