Skip to content

Translating vim macros to lua functions to enable debugging them #45

@matu3ba

Description

@matu3ba

What?
Debugging vim macros is outright painful, because they may silently abort without knowledge to user where and due to what reasons.
Macros can not be executed step by step, so any workaround would be helpful. The workaround of how to debug vim macros is to translate it into vim functions: "The pain of converting to a function is only worth it if you use it a lot.".
Why not use the simpler language lua instead and automatize the process?
Related discussion.

Why?

  1. Make macros inspectable, reusable and store them as plain lua instead of invalid UTF8.
  2. Semiautomatically generate lua code from key actions.
  3. Generate the lua code from motions on code to generate refactoring snippets to share
  4. (crazy idea) Translate code back to vim motions.

Potential existing implementations:
No, the state of debugging vim macros is poor as can be seen from the issues.

Potential pitfalls:
Yes, this is depending on fixing the core (keymap) event handling infrastructure of vim. See this attempt to show inbuilds and this closed issue of vim.
The other dependency is the completion of the necessary metadata.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @matu3ba

        Issue actions

          Translating vim macros to lua functions to enable debugging them · Issue #45 · nvim-lua/wishlist