> 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.
>
> For this specific task there are possibly alternative solutions, like
> making a new buffer with all numbers that need to be looked up and
> then running a script that would do the job. Anyway, I'd like to know
> if the above is possible at all and how.
I might try using the search() function and the v:count variable rather than a / search. <count> is for user-defined commands using the :command command, not for mappings using the :map command set.
--
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