Skip to content

add macro command - #399

Merged
asottile merged 1 commit into
asottile:mainfrom
NicholasLinderWood:add-macro-command
Sep 1, 2026
Merged

asottile merged 1 commit into
asottile:mainfrom
NicholasLinderWood:add-macro-command

Conversation

@NicholasLinderWood

@NicholasLinderWood NicholasLinderWood commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Adds a new <esc> command :m <macro_name> which inserts the text in the file ~/.config/babi/macros/<macro_name> if it exists.

A couple of notes:

  • During our discussion in Optional Template for New File - Feature Request #360 you mentioned calling the command :m for "macro" but entitled the config directory "snippets". At least for me, I thought it made more sense to use "macros" instead of "snippets" (to be consistent with the naming of the command). If you feel otherwise it's obviously fine to go back to calling these snippets, but wanted to give my two cents.
  • I don't currently have any status update if loading the macro is successful. If you'd like that I can add it as well.

resolves #360

@asottile asottile left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty good -- nice and simple and works well -- a few things though:

  • this should probably get its own dedicated function in file.py with an appropriate @edit_action etc. decorators (right now if you undo a macro it says undo: uncut selection)
  • it should probably post a status after the macro itself is applied -- just something simple

Comment thread babi/screen.py Outdated
Comment thread tests/features/conftest.py Outdated
Comment thread tests/features/command_mode_test.py Outdated
Comment thread babi/screen.py
Comment thread babi/screen.py Outdated
@NicholasLinderWood

Copy link
Copy Markdown
Contributor Author

I believe all of these have been addressed! Please let me know if there is anything else! :)

@asottile asottile left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile
asottile enabled auto-merge September 1, 2026 16:43
@asottile
asottile merged commit 1d49de3 into asottile:main Sep 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional Template for New File - Feature Request

2 participants