knowledge-database (beta)

Current group: comp.editors

vim searching across split files

vim searching across split files  
Ashot
 Re: vim searching across split files  
Mikolaj Machowski
 Re: vim searching across split files  
Ashot
 Re: vim searching across split files  
Preben 'Peppe' Guldberg
 Re: vim searching across split files  
Ashot
From:Ashot
Subject:vim searching across split files
Date:Sat, 15 Jan 2005 21:40:30 -0800
Is there an easy way to search across all files in a split vim window?

right now I use
> :windo g/searchstring

but it doesn't print the file names, so should I write a script, or is
there something built in? I'm having trouble getting grep to work in
windows (cygwin grep).

Thanks

--
--
Ashot Petrosian
University of Texas at Austin, Computer Sciences
From:Mikolaj Machowski
Subject:Re: vim searching across split files
Date:16 Jan 2005 22:09:10 GMT
Ashot scripsit:
> Is there an easy way to search across all files in a split vim window?
>
> right now I use
>> :windo g/searchstring
>
> but it doesn't print the file names, so should I write a script, or is
> there something built in? I'm having trouble getting grep to work in
> windows (cygwin grep).
>
In grep.vim is command GrepArgs command, not exactly what you want.

Check http://www.vim.org for grep scripts.

Solution for grep problem could be downloading development version of
Vim7 with :vimgrep command:

*:vim* *:vimgrep* *E682* *E683*
:vim[grep][!] /{pattern}/ {file} ...
Search for {pattern} in the files {file} ... and set
the error list to the matches.
{pattern} if a Vim search pattern. Instead of
enclosing it in / any non-ID character |'isident'|
can be used, so long as it does not appear in
{pattern}.


m.
--
LaTeX + Vim = http://vim-latex.sourceforge.net/
Vim Universal Templates: http://vim.sf.net/script.php?script_id=1078
vim.pl - http://skawina.eu.org/mikolaj
CLEWN - http://clewn.sf.net
From:Ashot
Subject:Re: vim searching across split files
Date:Sun, 16 Jan 2005 15:32:28 -0800
thanks, I'm not brave enough for the development version =]

On 16 Jan 2005 22:09:10 GMT, Mikolaj Machowski wrote:

> Ashot scripsit:
>> Is there an easy way to search across all files in a split vim window?
>>
>> right now I use
>>> :windo g/searchstring
>>
>> but it doesn't print the file names, so should I write a script, or is
>> there something built in? I'm having trouble getting grep to work in
>> windows (cygwin grep).
>>
> In grep.vim is command GrepArgs command, not exactly what you want.
>
> Check http://www.vim.org for grep scripts.
>
> Solution for grep problem could be downloading development version of
> Vim7 with :vimgrep command:
>
> *:vim* *:vimgrep* *E682* *E683*
> :vim[grep][!] /{pattern}/ {file} ...
> Search for {pattern} in the files {file} ... and set
> the error list to the matches.
> {pattern} if a Vim search pattern. Instead of
> enclosing it in / any non-ID character |'isident'|
> can be used, so long as it does not appear in
> {pattern}.
>
>
> m.



--
--
Ashot Petrosian
University of Texas at Austin, Computer Sciences
From:Preben 'Peppe' Guldberg
Subject:Re: vim searching across split files
Date:16 Jan 2005 22:11:13 GMT
Ashot wrote:
> Is there an easy way to search across all files in a split vim window?

> right now I use
>> :windo g/searchstring

> but it doesn't print the file names, so should I write a script, or is
> there something built in? I'm having trouble getting grep to work in
> windows (cygwin grep).

How about this:

:windo g/pattern/echo expand("%") . ':' . line('.') . ':' . getline('.')

Preben
--
se nocp cpo=BceFsx!$ hid bs=2 ls=2 hls ic " P. Guldberg /bin/vi@wielders.org
se scs ai isf-== fdo-=block cino=t0,:0 hi=100 ru so=4 noea lz|if has('unix')
se sh=/bin/sh|en|syn on|filetype plugin indent on|ono S V/\n^-- $\\|\%$/
cno |au FileType vim,mail se sw=4 sts=4 et|let&tw=72+6*(&ft=~'v')
From:Ashot
Subject:Re: vim searching across split files
Date:Sun, 16 Jan 2005 15:37:54 -0800
This works well enough for me, I used this to make it easier to call:

function! SGlobal(...)
execute "windo g/" . a:1 . "/echo expand(\"%\") . ':' . line('.') . ':' .
getline('.')"
endfunction
com! -nargs=* G call SGlobal()

usage:
:G pattern


thanks!


On 16 Jan 2005 22:11:13 GMT, Preben 'Peppe' Guldberg
wrote:

> Ashot wrote:
>> Is there an easy way to search across all files in a split vim window?
>
>> right now I use
>>> :windo g/searchstring
>
>> but it doesn't print the file names, so should I write a script, or is
>> there something built in? I'm having trouble getting grep to work in
>> windows (cygwin grep).
>
> How about this:
>
> :windo g/pattern/echo expand("%") . ':' . line('.') . ':' .
> getline('.')
>
> Preben



--
--
Ashot Petrosian
University of Texas at Austin, Computer Sciences
   

Copyright © 2006 knowledge-database   -   All rights reserved