Hi, Bee schrieb am 14.07.2016 um 08:28: > I tried to pass a count to <F11> but got a range error. > > nmap <F11> :call VMA()<bar>:bn<cr> > > Can it be done? > > nmap <F12> :bn<cr> > > 4<F12> works
in my experience counts and mappings don't work together very well. A preceding count is always used for the first command in the mapping only. So what happens when you enter 4<F11> is that Vim converts your count to an address for the command-line, which effectively results in :.,.+3call VMA()|:bn In your mapping you first have to remove this address and "move" the count to the front of the command :bn. The count is stored in the global variable v:count. There is an example at :help v:count which can be adopted: :nmap <F11> :<C-U>call VMA()<bar>execute v:count1 . "bn"<cr> Note that I removed the superfluous second colon and that instead of v:count I used v:count1 which defaults to 1 if no count was given. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
