> On May 21, 2011 12:30 AM, "Antonio Recio" <amdx64bt@gmail.com> wrote:
> >
> > The two commands to delete the comments of C++ files are:
> > :%s!\s*//.*\|/\*\_.\{-}\*/
> > :g/^\s*$/d
> >
> > How I can add this commands to my bash script?
> >
>
> The right tool for the job I think: sed, awk, perl, lisp, etc. I don't think
> vim is the right tool.
>
> That said, I'm sure there's a way. OTOH, if you're a hammer, everything
> looks like a nail :)
>
> --
> 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
As mentioned above, this will not be fast but here is how you can make it:
You can write a vimscript, which iterates over files in path and runs this
commands.
You can start with this:
for file in filter(split(globpath(getcwd(), "**"), "\n), "!isdirectory(v:val)")
exe "edit ".file
.... your substitutions ...
wq
endfor
Then in your bashrc file you can add:
vim -nX -S YourScriptName.vim -cq!
Best,
Marcin Szamotulski
--
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