sponsor Vim development Vim logo Vim Book Ad

substitute.vim : Fast mappings for performing substitutions

 script karma  Rating 18/8, Downloaded by 1160    Comments, bugs, improvements  Vim wiki

created by
Anders Thøgersen
 
script type
utility
 
description
Visual and normal mode mappings for easy access to substitutions with the
s/// command.

This script will make it easy to replace the word under the cursor, or the
visually selected text across the whole file. If more than one line is
selected the substitution will only occur on the selected lines.

substitute.vim provides the following two mappings for both visual and normal
mode:

   ;;  Run :substitute on the current buffer without prompting.

   ;'  The same, only prompt for each.

   ';  Perform substitution on the lines that match a multi-repeat
       expression, prompting for each.

These mappings can be changed as specified in the following section.

It is also possible to press <C-R><C-R> while in command line mode to insert
the text that is replaced into the commandline.

When the search and replace has completed the cursor can be returned to where
the search started by jumping to mark ' (pressing '' or `').

github: https://github.com/aklt/vim-substitute

Note:
- The contents of a register (default "9) is overwritten

 
install details
Place substitute.vim into the plugin directory, or source it from within vim.
 

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
substitute.vba.gz 1.2 2010-12-29 7.0 Anders Thøgersen Added GlobalMap mapping, SingleWordSize option.

Can now also be found at http://github.com
substitute.vba.gz 1.1 2009-03-03 6.0 Anders Thøgersen Use VimBall and GetLatestVimscripts
substitute.vim 1.04 2005-09-27 6.0 Anders Thøgersen Added a separate helpfile and the possibility of changing
mappings and the register that the script uses.
substitute.vim 1.03 2005-01-12 6.0 Anders Thøgersen Changed the meaning of the ;' mapping, and added <unique> to the map
definitions.  Added the Escape function so $ and ^ are only escaped when they
appear at the beginning, or at the end.
substitute.vim 1.01 2004-12-27 6.0 Anders Thøgersen The check to see if the mappings already exist has been removed.  It is probably better to let the user add his or her preferred mappings by modifying the script.
substitute.vim 1.0 2004-12-25 6.0 Anders Thøgersen Initial upload
ip used for rating: 54.197.94.241

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.
   
SourceForge.net Logo