Let's say I have a mapping such as this:

nnoremap K :call MyFunction()

And my function is:

func MyFuction()
    echom ("how to get the 10 passed to me?")

Let's say the user presses 10K on their keyboard. Is there a way for me to retrieve the number 10 from the MyFunction()? The function is called similar to:

:.,.+9 call MyFunction()
  • @Biggybi yes thank you -- I can do a:lastline - a:firstline.
    – David542
    Jun 15, 2020 at 2:12
  • No problem, I'm glad it helped!
    – Biggybi
    Jun 15, 2020 at 2:43
  • See :h v:count or :h v:count1
    – Matt
    Jun 15, 2020 at 5:59


Browse other questions tagged or ask your own question.