> Chris
>
> I do have Cygwin here and I cannot tell which grep Vim(windows
> version) uses to be honest, since I cannot get grep to print the
> platform but I believe it is the windows version from Windows Gnu
> utilities which has v 2.5 while Cygwin version is 2.6. I have both
> greps in my system because I am on 64bit and I had issues with Cygwin
> utilities.
>
> In any case I have export ed $INCLUDES in my .bashrc so when I echo in
> Cygwin shell
>
> $ echo $INCLUDES
> /cygdrive/c/MinGW/include
>
> When I echo in Vim
> "c:\\MinGW\\include"
>
> I am using Windows version of Gvim
>
> I feel like Vim is not expanding $INCLUDES to grep in this command
> because if I just put straight absolute path to MinGW\include grep
> works
> works
> ":grep -i rand c:\MinGW\include/*"
>
> does not work
> ":grep -i random $INCLUDES/*"
Vim doesn't expand environment variables in commands executed by the
shell, it lets the shell do the expansion. If your shell is
Window's cmd.exe, it won't know how to expand a Unix-style
environment variable.
To see which shell Vim is using, execute
:set shell?
You should be able to see the command Vim executes when you execute
:grep -i random $INCLUDES/*
When I do that, I see
:!findstr /n -i random $INCLUDES/* >C:\DOCUMEN~1\garyjohn\LOCALS~1\Temp\VIeCF5.tmp 2>&1
shell returned 1
(1 of 1): FINDSTR: Cannot open $INCLUDES/*
(You may have redefined 'grepprg', but if your shell is cmd.exe, the
principles will be the same.)
I don't have $INCLUDES defined, so I tried an environment variable
that I do have defined, $USERNAME. The results were essentially the
same, as expected.
:!findstr /n -i random $USERNAME/* >C:\DOCUMEN~1\garyjohn\LOCALS~1\Temp\VIeCFA.tmp 2>&1
shell returned 1
(1 of 1): FINDSTR: Cannot open $USERNAME/*
However, the following worked, in the sense that $USERNAME, or
rather %USERNAME%, was correctly expanded.
:grep -i random \%USERNAME\%/*
:!findstr /n -i random %USERNAME%/* >C:\DOCUMEN~1\garyjohn\LOCALS~1\Temp\VIeCFB.tmp 2>&1
shell returned 1
(1 of 1): FINDSTR: Cannot open garyjohn/*
HTH,
Gary
--
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