sponsor Vim development Vim logo Vim Book Ad

multipleRanges.vim : Selecting different ranges of lines

 script karma  Rating 13/7, Downloaded by 2486  Comments, bugs, improvements  Vim wiki

created by
Salman Halim
 
script type
utility
 
description
This script lets you choose multiple non-consecutive ranges and then execute commands on them all at the same time.  Just visually select a range of lines and hit the mapping sequence.  Repeat until all the ranges have been selected (they will be highlighted).  Then, execute the script-defined command Rangecommand with the actual command (and arguments) as arguments to Rangecommand and it'll do it.  The ranges will remain selected until you execute the reset mapping allowing you to execute more commands on the ranges.

NOTE:  VERSION 1.2 AND ABOVE DEPEND ON MY getVar.vim vimscript#353 AND variableSort.vim vimscript#354.  Sorry I neglected to mention that before.

Version 1.8: No new functionality; brought the plugin up to Vim version 7.2, using Lists and removing the dependence on variableSort.vim (getVar.vim is still required).
 
install details
Pop it into the plugin directory.  Read the usage comments in the plugin for, well, usage directions.
 

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
multipleRanges.vim 1.8 2011-04-11 7.2 Salman Halim No new functionality; brought the plugin up to version 7.2, using Lists and removing the dependence on variableSort.vim (getVar.vim is still required).
multipleRanges.vim 1.7 2002-08-20 6.0 Salman Halim Added a new command (Rangecommandnormal) which allows for a normal-mode command to be executed on the ranges. Also added mappings to quickly enter the Rangecommand and Rangecommandnormal command-lines. Added error-checking in case there are no ranges currently selected when the commands are executed.
multipleRanges.vim 1.65 2002-07-27 6.0 Salman Halim Removed the unique keyword from the internal script mappings as Vikas Agnihotri pointed out that this was causing a problem with potential reloading of the script while not adding anything to the ease of use.
multipleRanges.vim 1.6 2002-07-26 6.0 Salman Halim Added  support for  user-defined highlights for  the ranges  (GUI only; will do cterm if asked).
multipleRanges.vim 1.5 2002-07-26 6.0 Salman Halim Depends on getVar.vim vimscript 353 and variableSort.vim vimscript 354.  Added the ability to invert range.  Ranges are now on a per-buffer basis instead of a per-window (was causing problems where a new buffer in the same window would act up).
multipleRanges.vim 1.2 2002-07-25 6.0 Salman Halim Cleans  up better once  a set of ranges  is cleared (the  variables are unlet).
Added  an  option (buffer  or  global  variable called  'consolidateRanges') which,  if  set  to 1,  will  cause  Rangecommand  to  first sort  and  then consolidate  overlapping ranges  into a  single range  before executing  the command. The ranges will remain consolidated once the command is done.
multipleRanges.vim 1.1 2002-07-25 6.0 Salman Halim Added a new command to show the current list of ranges (ugly output), made the script more plugin-like and updated usage comments slightly.
multipleRanges.vim 1.0 2002-07-25 6.0 Salman Halim Initial upload
ip used for rating: 3.15.156.140

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