Answer the question
In order to leave comments, you need to log in
How to use numbers before a command in Vim?
Actually, how to make the number entered before pressing your own keyboard shortcut set not the number of repetitions, but something else.
For example, creating a for loop from zero to the entered digit should look something like this:
map <Number><A-m> Afor (int i = 0; i < <Number>; i++) {<Enter>
function! MyFor(v)
python <<EOF
import vim
v = vim.eval("a:v")
vim.current.line = vim.current.line + "for (int i = 0; i < " + v + "; i++) {"
EOF
endfunction
nnoremap <A-f> :<C-U>call MyFor(v:count)<CR>o<Esc>o}<Up><Tab>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question