On 04/06/09 14:50, [email protected] wrote:
>
> hello,
>
> does anybody know how to get the number of search results inside a file?
> Something like " NUMBER_OF_CURENT_RESULT ::
> NUMBER_OF_TOTAL_OCCURRENCES" on statusline would be perfectly.
>
> greetings,
> dan
This may look wasteful, but it may be just what you need (after all, to
know how many matches there are in the whole file you have to search the
whole file for all of them) and it has the advantage of being ready-made:
:vimgrep /pattern/g %
will count the occurrences in the current file, jump to the first one,
and display something like
(1 of 65)
(followed by the text of the matching line) below the bottom statusline.
Add a j after the /g if you don't want to jump to the first match, and
you may also open the quickfix window by :copen to see one line for each
match (click to move to one of them in the other window).
For this and other quickfix commands, the following (or similar)
mappings may come in handy:
" F2 goes to next match
:map <F2> :cn<CR>
" Shift-F2 goes to previous match
:map <S-F2> :cN<CR>
See also ":help quickfix.txt".
Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
44. Your friends no longer send you e-mail...they just log on to your IRC
channel.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---