On Apr 21, 9:52 pm, meino.cra...@gmx.de wrote: > At work I am not allowed all that nice gimmicks like > grep, find, sed etc. which were ported to windows also > due to security reasons. > > I would like to get back some of that functionality > mainly of text related Unix tools via vim. > > First step into that direction is the answer to > the question, whether it would be possible to > apply a certain "command" (here, I mean with > "command" anything which does something with > text) to a bunch of files of a certain > pattern in a directory from within vim. >
A few possibilities I know of: 1. Use a loop construct in Vim (for, while), with the glob() function, to do something to each file returned by the function. 2. Launch Vim with all the files you want (which I think can use wildcards) and use the :bufdo or :argdo commands. 3. Modify/use the argument list within Vim, and use the :argdo command. See :help argument-list and following help sections and links. 4. Use Vim's command-line options to run the commands you want, within a "for" loop in a cmd.exe shell. Of particular use would be the -c and --cmd command-line options to Vim, and the following reference page for the available DOS-style commands (including for loops): http://technet.microsoft.com/en-us/library/cc778084(WS.10).aspx You specifically mentioned the grep and find commands. Vim has a :find command (though the glob() function is more like the Unix find command I think), and also a :grep command (which by default on Windows will use the 'findstr' utility, not nearly as powerful as grep), and finally a :vimgrep command (which is entirely built-in, allowing you to use the full power of Vim's regular expressions). For the last two commands I mention, obviously you can see the :help, but also take a look here: http://vim.wikia.com/wiki/Find_in_files_within_Vim -- 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 Subscription settings: http://groups.google.com/group/vim_use/subscribe?hl=en