Tuesday, April 24, 2012

Re: Use count as argument for a map

On 2012-04-24, esquifit wrote:
> I have a bunch of numbers and for each of them I have to find all
> occurrences in a file, that is: for the first number, find all lines
> containing the number, for the second one the same, and so on. Since
> this is repetitive process, I'd like to minimize the number of key I
> have to type. I'm trying to get something like this to work:
>
> 345<F7> --> display all lines containing '345'
>
> For a fixed number, this would be something like
>
> nnoremap <F7> /\<345\><CR>[I
>
> However I cannot see how could I pass the numeric argument to the
> mapping. I've tried mapping keys to commands where I'm allowed to use
> things like <count> or <args> and even functions, but I'm still
> failing to find a solution. I'm aware that I'm trying to (ab)use a
> *count* as an *argument* and that this is probably why there is no way
> to achieve what I'm attempting, but you never know, therefore I'm
> asking here.

:help v:count
:help v:count1

HTH,
Gary

--
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

No comments:

Post a Comment