(Change <tt> to <code>, perhaps also minor tweak.)
Line 11:
Line 11:
|category2=
|category2=
}}
}}
−
You can use the [http://www.drchip.org/astronaut/vim/index.html#VISINCR Visual Incrementing script] to convert a block of numbers selected via Ctrl-v (visual block) into a column of increasing integers. Select the column then enter <tt>:I</tt> to replace the selection. The first line's number is used as a starting value, and the number in each subsequent line is incremented by one.
+
You can use the [http://www.drchip.org/astronaut/vim/index.html#VISINCR Visual Incrementing script] to convert a block of numbers selected via Ctrl-v (visual block) into a column of increasing integers. Select the column then enter <code>:I</code> to replace the selection. The first line's number is used as a starting value, and the number in each subsequent line is incremented by one.
If the Ctrl-v block is "ragged right", which can happen when "$" is used to select the right hand side, the block will have spaces appended as needed to straighten it out. If the strlen of the count exceeds the visual-block allotment of spaces, then additional spaces will be inserted.
If the Ctrl-v block is "ragged right", which can happen when "$" is used to select the right hand side, the block will have spaces appended as needed to straighten it out. If the strlen of the count exceeds the visual-block allotment of spaces, then additional spaces will be inserted.
−
Example: Put cursor on topmost zero, select column with Ctrl-v, then enter <tt>:I</tt>
+
Example: Put cursor on topmost zero, select column with Ctrl-v, then enter <code>:I</code>
<pre>
<pre>
vector[0] = 1; vector[0] = 1;
vector[0] = 1; vector[0] = 1;
Line 42:
Line 42:
----
----
An additional script, calutil.vim, adds some calendrical date to/from Julian day conversion functions. With those, visincr.vim now has new commands:
An additional script, calutil.vim, adds some calendrical date to/from Julian day conversion functions. With those, visincr.vim now has new commands:
−
*<tt>IMDY [incr]</tt> : make a column of month/day/year dates
+
*<code>IMDY [incr]</code> : make a column of month/day/year dates
−
*<tt>IYMD [incr]</tt> : make a column of year/month/day dates
+
*<code>IYMD [incr]</code> : make a column of year/month/day dates
−
*<tt>IDMY [incr]</tt> : make a column of day/month/year dates
+
*<code>IDMY [incr]</code> : make a column of day/month/year dates
−
*<tt>ID [incr]</tt> : make a column of day names
+
*<code>ID [incr]</code> : make a column of day names
The optional incr (default value is 1) can be positive or negative. Both scripts are available at [http://www.drchip.org/astronaut/vim/index.html#VimFuncs Vim Functions].
The optional incr (default value is 1) can be positive or negative. Both scripts are available at [http://www.drchip.org/astronaut/vim/index.html#VimFuncs Vim Functions].
created 2001 · complexity intermediate · author Charles E. Campbell, Jr. · version 6.0
You can use the Visual Incrementing script to convert a block of numbers selected via Ctrl-v (visual block) into a column of increasing integers. Select the column then enter :I to replace the selection. The first line's number is used as a starting value, and the number in each subsequent line is incremented by one.
If the Ctrl-v block is "ragged right", which can happen when "$" is used to select the right hand side, the block will have spaces appended as needed to straighten it out. If the strlen of the count exceeds the visual-block allotment of spaces, then additional spaces will be inserted.
Example: Put cursor on topmost zero, select column with Ctrl-v, then enter :I
The vis.vim script at Visual Block Commands can apply a substitute to a visual-block.
visincr.vim supports:
:I<CR> will use the first line's number as a starting point, incrementing by 1
:I #<CR> like :I, but will increment by given number; negative numbers work fine
:II<CR> will pad on left as needed, otherwise like :I
:II #<CR> like :II, but will increment by given number
An additional script, calutil.vim, adds some calendrical date to/from Julian day conversion functions. With those, visincr.vim now has new commands:
IMDY [incr] : make a column of month/day/year dates
IYMD [incr] : make a column of year/month/day dates
IDMY [incr] : make a column of day/month/year dates
ID [incr] : make a column of day names
The optional incr (default value is 1) can be positive or negative. Both scripts are available at Vim Functions.