views:

93

answers:

3

I know that often using a for loop to generate repetitive content is the better way than pasting something 20 times and changing each paste to the correct number by hand. But let's say for cases where content is hard-coded and I just want a list from 1-20.

I would like a text editor with a "smart" paste command that takes any number imbedded in a string on the clipboard and increments it each time I paste. If it doesn't exist, I will make a plugin.

I'm trying to think of a good 2-stroke keyboard shortcut to do it, close to the ctrl-V. Maybe ctrl-g or numpad_+ (in an app with no zooming).

Does it exist?

+1  A: 

Armed bear J has a renumber region command, as well as a case-preserving replace-in-files, which means I often keep it around for those features.

Pete Kirkham
+1  A: 

TextPad is another text editor with a Fill Region function, for filling with a character, a string, or incrementing numbers (starting from X, with left- or right-alignment, and space- or zero-filled.)

I used Notepad++ now, but I have to keep TextPad around just for that number-filling function.

JMD
A: 

In Zeus this can be easily done as follows:

  1. Column mark the area to be converted to a numbers
  2. Use the Macros, Execute Script menu
  3. Type in numbers to run the numbers Lua macro
  4. Type in the first number of the sequence

The marked area will be replaced by an incrementing sequence of number starting at the first number provided in step 4.

I'm trying to think of a good 2-stroke keyboard shortcut to do it,

Making this into a key stoke action is as simple as binding the numbers Lua macro to the keyboard.

Here is an example of how it works. If 1 values in the text below are column marked and the macro executed with a starting number of 1000:

Field_1
Field_1
Field_1
Field_1

the following text changes will be made:

Field_1000
Field_1001
Field_1002
Field_1003
jussij