I have a mapping that looks like this:
nnoremap <expr> <c-x>b ":call MyFunction(" . v:count . ")\<cr>"
I also tried to instead define function with
range, but the effect is the same.
The point is to be able to press a number, followed by the mapping, e.g.
30<c-x>b. The problem is, it fails if the number of remaining lines in the file is less than count I input. The function actually don't do any line operations, so I don't care about actual number of lines. How can I make a mapping or a function that accepts count and isn't dependent on number of lines in open file?
Here's my final version, with working solution:
nnoremap <expr> <c-x>b ":\<c-u>call MyFunction(" . (v:count ? v:count . ")\<cr>" : ")\<left>")
With this, if I press
<number><c-b>x, the function is called immediately, or if I press just
<c-b>x, I go into command prompt and can enter number manually (using
v:count1 by default isn't suitable for my case).