I have a function that takes an argument (num) I'm wanting a mapping so that I can enter a number beforehand and it gets passed to the function.
e.g If I press 3<leader>i
I would like the following to happen:
:call MyFunction(3)
The repeat number is automatically stored in v:count and v:count1, whichever suits your needs. Also, you have to drop the line range out (:help c_CTRL-U):
nnoremap <Leader>i :<C-U>call MyFunction(v:count1)<CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With