On Dec 3, 7:30 pm, Gary Johnson <[email protected]> wrote:
> 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 have access to a Unix machine at present, so I can't
verify, but I am pretty sure that I've done this under Unix.
Andy's post, however, suggests that I might have been using a
different syntax, so that's likely the problem.
> 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})
There's no problem when I'm working from the command line, but
at least some of the files in question are already in the
editor, and I don't want to stop this instance of the editor in
order to edit them with another one.
> 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.
I'm using the Windows build of vim. I'm also only using parts
of Cygwin; for various reasons, many of the utilities also come
from direct Windows ports. And I am having problems with the
filenames. Not just from vim. What I'll probably end up doing
is using direct Windows ports for everything, since I can't
avoid using some Windows programs (e.g. cl), which expect
Windows filenames, and the CygWin version of some of the tools
(e.g. make) isn't as up to date as I'd like.
Not relevant to this group, but why do CygWin and MSys insist on
using only their version of filenames. All it does is make them
unduly difficult to use. (If I didn't need to use Windows
programs as well, there'd be no problem. But if I didn't need
to use Windows programs, I'd just install Linux and be done with
it.)
--
James Kanze
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php