Hot answers tagged

5 votes
Accepted

How do I play a macro, but *slowly* (for debugging a macro)

You may be able to set the 'writedelay' option. This will delay refreshing the screen by the given number of milliseconds. So try :set writedelay=50 and run your macro. Note, that if you use ...
Christian Brabandt's user avatar
4 votes

How do I play a macro, but *slowly* (for debugging a macro)

What you could do to achieve something like this is to convert your macro into another one that introduce 1 second delay between the operation using the 1gs operation or if in insert mode ^o1gs e.g.: ...
Vivian De Smedt's user avatar
3 votes

Delay inside Macro - Is It Possible in Vim Macros to Create a Delay Between Commands?

You can use the gs command to introduce a delay. This command can be prefixed with a count to specify the number of seconds. Refer to the help page for more information. For example, to introduce a ...
Yegappan Lakshmanan's user avatar
2 votes

How to get floating result in expression register?

If instead of registers you used variables, you could make them floats directly: :let h = 22.0 :let f = 4.0 … =h/f Or, you could "coerce" them: :let h = 22 :let f = 4 … =(h + 0.0)/f With ...
D. Ben Knoble's user avatar
  • 25.4k
2 votes

How to get floating result in expression register?

The content of a register is either a string or a list. In this case, both @h and @f are strings so you leave the coercion to :h expr-/, which takes the shortest path possible because there is no ...
romainl's user avatar
  • 39.3k
1 vote

Macros on lines with different structures

I would have the following macro: /\v(,|.})^Ma^M^[ And I would call it repeatedly. Where: ^M stands for Enter and ^[ stands for Esc
Vivian De Smedt's user avatar
1 vote
Accepted

Delay inside Macro - Is It Possible in Vim Macros to Create a Delay Between Commands?

To address your requirement of being able to read the output, I'd move the delay into the shell command: :let @p = "0D:!ping -c1 8.8.8.8 ; sleep 1\<CR>iJust pinged a DNS Server\<Esc>&...
Rich's user avatar
  • 31.3k
1 vote
Accepted

Repeat many times without macro?

I think you are confusing "macro" and "recording", here. The result of a recording is indeed a macro, but the RHS of a mapping and the argument of :normal are also macros. :normal ...
romainl's user avatar
  • 39.3k
1 vote

How to get floating result in expression register?

I would use the str2float function. printf("%f", str2float(@h)/str2float(@f)) Vim converts string into number when doing arithmetic but assuming strings are integers. If you want Vim to ...
Vivian De Smedt's user avatar
1 vote

in-place replacement of code in HTML documents with TOhtml?

OK, I need to think about something else than freaking Magento. Pandoc would help with the first step but the rest can be done with pure Vim commands… Tell :help :TOhtml to only generate fragments: :...
romainl's user avatar
  • 39.3k

Only top scored, non community-wiki answers of a minimum length are eligible