Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [macro]

A macro is a recording of typed commands that can be executed later. Macros are stored in registers; recording a macro can be done with q, and you can run them with @.

16 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers

How to Make Macros Stop with Custom Motion?

I am writing a custom Vim motion. The problem is that when used in a macro (especially at the end of a macro), the macro does not automatically stop when the motion no longer applies. For example, if ...
Jesse's user avatar
  • 41
4 votes
0 answers

Esc from insert in macro prints ê^ instead of running Esc

Here's a sample macro. 2Ea,^[j^ (Jump to the end of the second word, append a "," escape visual mode, and go to the next line.) Instead of 99 The, I get 99 The,ê^ and it stays stuck in insert mode. ...
newUserNameHere's user avatar
3 votes
1 answer

Use treesitter to jump to next argument without going into nested function calls

I'm hoping to write a macro that involves jumping to a second argument of a function call and deleting it. The function arguments will sometimes include nested function calls, sometimes not, will ...
Michael's user avatar
  • 131
2 votes
0 answers

How to split view all buffers in vim with equal distribution vertical horizontal

How can I split view all buffers in vim with a distribution between vertical and horizontal? Is there a plugin? I know how to make all buffers appear in either horizontal or vertical splits: :ball :...
Polo's user avatar
  • 41
1 vote
0 answers

Run macros in background while doing something else

I have a macro that calls APIs to fetch data based on information in a buffer. Is it possible to have the macro continue execution while I move to another window and work on other buffers?
user22476690's user avatar
1 vote
0 answers

Macro doesn't run properly when executed with :bufdo or :argdo

I have a macro that looks like: :reg a Type Name Content c "a /^where^MkV%yGo^M-- Some typing...:^[pVG:!/tmp/^M It works fine from any starting position in the file when I replay it ...
jberryman's user avatar
  • 133
1 vote
0 answers

Function call in macro

I have a function (from here) that requires an argument enclosed in quotes. if !exists('*Preserve') function! Preserve(command) try " Preparation: save last search, and ...
Tom's user avatar
  • 67
1 vote
0 answers

Terminal window interprets quick initial q as macro record

I have a function that opens a terminal window running some program. The program is quit by pressing q. But when I press q in the terminal window shortly after (within 1-2 seconds) of it being opened, ...
rlms's user avatar
  • 305
1 vote
1 answer

Vim go into insert mode when as a macro starts

When doing <ESC>qq you can record a macro into the q register (still in command mode though). How can I make <ESC>qq go into insert mode right away (without having to type i)? map qq qqi ...
Dosisod's user avatar
  • 111
1 vote
0 answers

Creating QuickFixed file to apply QuickFixes via diff

TL;DR I have macros in each %m captured by errorformat after :make. I'd like to have a copy of the file in another split and apply all the macros (so to have a fixed file) and then do a :windo ...
Sunny Pun's user avatar
  • 472
1 vote
0 answers

Macros behaving unexpectedly (not executing commands)

I have the following macro let @f='ivoid function (void param^[o {^M^M^[3kwi' where ^[ represents ESC and ^M new line. for some reason it does not execute anything after the 3k, I tried replacing ...
Jose V's user avatar
  • 121
0 votes
0 answers

How to search for yanked text in a macro?

How do I search for yanked text in a macro properly? I tried the following: qq (start a macro) yi" (yank text inbetween ", let's say the yanked text is foo) / press ctrl + r " (I ...
Sebastian Nielsen's user avatar
0 votes
2 answers

How to use a variable from register in command mode?

I have a list of cities London Madrid Paris Brasil I want to write a macro, that will add a ul tag and wrap each city in to an li. I think, i need to create a variable like: let i = 4 Than to write ...
serii 's user avatar
  • 91
0 votes
0 answers

Macro not working as expected

I have a list such as follows apple banana cherry I am trying to write a macro that will get it in this format (I am writing a .yaml file) - "apple" - "banana" - "...
Saul Alarcon's user avatar
0 votes
0 answers

Trouble running Ex commands after normal mode commands in a macro

I have the following macro: ggdG"+p :try|%s/\V${NodeName}/${N=SwisEntity;M=DisplayName}/|catch||endtry :try|%s/\V${IP}/${N=SwisEntity;M=IP_Address}/|catch||endtry :try|%s/\V${IP_Address}/${N=...
Justus Grunow's user avatar
0 votes
0 answers

Is there a way to disable plugins during macro recording and execution?

Is there a way I can disable specific (or all) plugins when recording a macro and then when playing back the macro? I've had an issue where a plugin that automatches ( with ) that stops a macro that ...
triplej's user avatar
  • 103