139155Re: error doing search using :grep or findstr
- Sep 14, 2013On Saturday, September 14, 2013 8:37:38 AM UTC-5, dapio wrote:
> If I run findstr from a cmd prompt, I can see that if you give it no parameters, then it says bad command.. And if you give it a pattern and no file or stdin, then it tries to take from stdinBecause, 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.
> C:\>"c:\Program Files (x86)\Vim\vim74\vim"
> FINDSTR: Bad command line
> C:\>findstr there
> 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
> Why can't it read what is in 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:
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
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic Next post in topic >>