3

i have made a macro that reformat a word that example apple to be .apple(apple) and i have saved that macro to be remapped with the <leader>z combination as follows nnoremap <leader>z 0yiwI.<esc>a(<esc>hpA),<esc>j0 the problem is when i type a number followed by <leader>z expecting the command to be repeated by the number i have given, it instead moves 10 lines downward i.e. it excutes the part only how do i fix that behaviour where i enter the number of repetitions of the command i want and it excutes correctly Note: I have the leader key remapped to space

Ramy Osama
  • 98
  • 1
  • 9

1 Answers1

3

If you want to keep using that macro over and over again, the most effortless way is to assign it to a register in your vimrc:

let @z = "0yiwI.\<esc>a(\<esc>hpA),\<esc>j0"

and use it like this:

@z
10@z
romainl
  • 186,200
  • 21
  • 280
  • 313