I am looking for a way to make a vim binding where I can enter control C (both the control and c keys at the same time), then another option (similar to yy
or dd
. For example, ctrl+c then 1 would be set so that a function I define, called my func, would be called like so: myfunc(1)
Here is my attempt so far: map <C-A> <F1>:call myfunc(1)<CR>
You can do it, with a few amendments:
<Leader>c
With these notes, you might do it like this:
nnoremap <silent> <Leader>c :<C-u>call MyFunc(v:count)<CR>
v:count
is a predefined variable that takes the value of the counter you passed to the last normal mode command, or 0 if there was no counter. There's also v:count1
that does the same thing, except it defaults to 1 if there was no counter.