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 ie 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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.