C:\>"c:\Program Files (x86)\Vim\vim74\vim"
C:\>
C:\>
C:\>findstr
FINDSTR: Bad command line
C:\>findstr there
dsfsdf
dsfds
C:\>
When in VIM,
e.g. I open a cmd prompt and run
C:\Program Files (x86)\Vim\vim74>vim.exe
I write some text dfdsfdsfsdfsdfsdfsds__there_dfsdfdsfdsfdsfsd
and do
:grep there
then it exits back to the cmd prompt and tries to read stdin until I Ctrl-C
http://i.imgur.com/ES5yHea.png
Why can't it read what is in VIM?
Because, the :grep command is what Vim uses to search files. You still need to provide the files to search. See http://vim.wikia.com/wiki/Find_in_files_within_Vim.
If you want to search the current file with findstr instead of Vim's built-in search, you can grep the current file:
:grep foo %
Note this searches the on-disk file, you would need to save first.
Alternatively, if you don't care about using quickfix, you can write the current buffer content to stdin and see the result only in the pop-up command window:
:w !findstr foo
Or, filter the buffer through findstr, replacing the buffer contents with the result:
:%!findstr foo
When I write a file, save it as e.g. ~/d.dd
do :grep there %
It then exits back to the shell where I had launched vim and the shell then says
So it adds the "Shell returned 1" line and the "Press ENTER line"
"C:\Program Files (x86)\Vim\vim74>vim
shell returned 1
Press ENTER or type command to continue"
If I press ENTER it adds these lines
"(1 of 1): FINDSTR: Cannot open d.dd
Press ENTER or type command to continue"
that last line is in green, if I push ENTER it goes back into VIM.
> Alternatively, if you don't care about using quickfix, you can write the current buffer content to stdin and see the result only in the pop-up command window:
>
> :w !findstr foo
that line works
>
> Or, filter the buffer through findstr, replacing the buffer contents with the result:
>
> :%!findstr foo
yep, that does as you state I see that when the pattern is there it leaves it, and when it isn't there it wipes the buffer.
so I can't get the :grep there % to work, even when the file is saved
Works fine for me. I had to set 'noshellslash' first but this is the default setting.
>
> If I press ENTER it adds these lines
>
> "(1 of 1): FINDSTR: Cannot open d.dd
> Press ENTER or type command to continue"
>
Did the file actually save? This is a strange error since it is already open in a buffer...