On 2009-12-03, James Kanze wrote:
> I've recently started working on a Windows platform, and I'm
> having some problems that, IIRC, worked correctly (i.e. did what
> I expected) on Unix platforms.  In particular:
> 
>     :args ! egrep -l 'some string' *.{h,cpp}
> 
> I expect this to set the file list to all of the files
> containing "some string" (for later use with argdo, for
> example); I use this a lot when "modernizing" C++ sources.
> Under Windows, I end up with "new file !" or something along
> those lines.
> 
> I've installed CygWin, and set vim up so it uses bash as its
> shell.
> 
> What do I have to do to get this to work?  I need it fairly
> badly, since I have to deal with a large body of existing code,
> in which I often have to make global changes.

Are you sure this used to work under Unix?  I don't see how it could
have, since the ":args" command accepts only a list of files, not a
command that returns a list of files.

If I execute that command on a Linux system, I get

    "!" [New File]

just as you did on Windows.

I could achieve what you want with this, however:

    :exe 'args!' substitute(system("egrep -l 'some string' *.{h,cpp}", '\n', ' 
', 'g')

where that is all on one line.  The same command worked fine in
Cygwin, using Cygwin's vim.  It's probably easier to instead start
vim from the command line like this:

    vim $(egrep -l 'some string' *.{h,cpp})

Alternatively, if you want to see the places in those files where
'some string' is used, you could use vim's :grep command like this:

    :set grepprg=egrep\ -n
    :grep -l 'some string' *.{h,cpp}

Are you using Cygwin's vim or Windows' vim?  While you _can_ use
Cygwin's bash from Windows' vim, I don't recommend it.  Sooner or
later you will run into a problem, usually with path names.  IMO,
it's just not worth the hassle.  If you want to use vim as you would
on Unix, use Cygwin's vim.

Regards,
Gary


-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to