I would like findstr /m background *.vim | gvim to open all *.vim files containing background in a single instance of gvim – but I can’t get the piping to work.
This is very similar to this question but instead of capturing the stdin output I would like GViM to treat the output as a list of files to be opened – and on a Windows system so xargs isn’t guaranteed. Any ideas?
I can think of a few ways of doing this:
Use vimgrep
Use vimgrep: after running gvim, enter:
This will populate the quickfix list with all of the matches (possibly more than one per file), so you can use things like
:copen,:cw,:cnetc to navigate (see:help quickfix)Use vim’s built-in cleverness
Use
findstrto give you a list of files and then get vim to open those files:This will load each file, but will keep the list of files open as well (you can always bunload it or whatever).
Edit:
Using
:tabediton a list of files didn’t work (I’d only tested:badd). You can get round this by either using badd and then bufdo (as above) or by doing something like this (put it in your vimrc):Then simply open the file containing all of your required file names and type:
Use Vim’s server functionality and some awful batch scripting
Use the server functionality and some batch script magic (which I don’t understand as I use bash)
Eeeurrgh.
If it were me, I would go with the “Use vim’s built-in cleverness” option. Actually, that’s not true: I’d use cygwin’s bash script and just use bash, but if I HAD to do it with the native tools, I’d use the built-in cleverness approach.