sponsor Vim development Vim logo Vim Book Ad

cream-replacemulti : Replace text across multiple files

 script karma  Rating 51/17, Downloaded by 1288  Comments, bugs, improvements  Vim wiki

created by
Steve Hall
 
script type
utility
 
description

This script replaces text across multiple files. It is a pure Vim implementation and does not depend on external utilties that do similar things (like sed, grep, cat, or Find). As such, it is cross-platform and has been tested on both Windows95/XP and Linux.

Replace Multi is intended to be used in the GUI version of Vim, gVim. It presents a rather hackish dialog to take user input for the Find, Replace, and Path components and present options for Case Sensitivity and the use of Vim's Regular Expressions. (Some day in the future it might be adapted to work from the command line without a dialog.)

In testing, Replace Multi performed a replacment operation on 1000 small files in 25 seconds. (2.80Ghz Pentium 4 Windows XP machine with 1Gb of RAM.) Obviously Vim and system settings could vary this greatly, but as a benchmark this is about 40 files/second.


This is one of many custom utilities and functions for gVim from the Cream project (http://cream.sourceforge.net), a configuration of Vim for those of us familiar with Apple and Windows software.

 
install details

This script is dependant on MultVals (http://www.vim.org/script.php?script_id=171).

Just drop cream-replacemulti.vim and multvals.vim into your plugins directory. Then (re)start Vim and use the command line to call function Cream_replacemulti():

  :call Cream_replacemulti()

or use mappings like:

  imap <C-F3> <C-o>:call Cream_replacemulti()<CR>
  vmap <C-F3> :<C-u>call Cream_replacemulti()<CR>
  nmap <C-F3>      :call Cream_replacemulti()<CR>

 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
cream-replacemulti.vim 1.0 2005-01-20 6.0 Steve Hall Initial upload
ip used for rating: 18.208.172.3

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github