You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When doing recursive macros, you need a guard condition to exit the macro repetition. I usually create a guard by either failing search or checking I can't move the cursor further because of the end of the line/file, which triggers an error and therefore stops the execution. This however, forbids nested recursive macro execution.
An example:
Macro №1: open a file at current line (from a file list) in a new tab, execute recursive macro №2, call macro №1.
Macro №2: search for a pattern (recursion guard condition, which causes an error), fix it, call macro №2.
Possible fix
A possible fix I can think of right now would be creating a normal mode prefix command that would stop the last macro's execution without triggering an error, but this would require a stack for the macro execution, which I'm not sure is present.
E.g. if mg would be the macro guard prefix, which would only stop last, not all macro execution, then mg/pattern would stop only the last macro upon a failing search.
Actual behaviour
Macro №1 never recurses, because the guard of macro №2 stops all execution.
Expected behaviour
Macro №1 recurses until its own guard triggers.
The text was updated successfully, but these errors were encountered:
nvim --version
: NVIM v0.4.4When doing recursive macros, you need a guard condition to exit the macro repetition. I usually create a guard by either failing search or checking I can't move the cursor further because of the end of the line/file, which triggers an error and therefore stops the execution. This however, forbids nested recursive macro execution.
An example:
Macro №1: open a file at current line (from a file list) in a new tab, execute recursive macro №2, call macro №1.
Macro №2: search for a pattern (recursion guard condition, which causes an error), fix it, call macro №2.
Possible fix
A possible fix I can think of right now would be creating a normal mode prefix command that would stop the last macro's execution without triggering an error, but this would require a stack for the macro execution, which I'm not sure is present.
E.g. if
mg
would be the macro guard prefix, which would only stop last, not all macro execution, thenmg/pattern
would stop only the last macro upon a failing search.Actual behaviour
Macro №1 never recurses, because the guard of macro №2 stops all execution.
Expected behaviour
Macro №1 recurses until its own guard triggers.
The text was updated successfully, but these errors were encountered: