I don’t know about you, but in the past, I’ve spent a lot of time editing files where I write a line of code which contains a number, duplicate that line a bunch of times, and then proceed to change the number in each line such that they increment by one. The following animated GIF illustrates the problem.
Wouldn’t it be nice if our editor helped us do this type of enumeration more quickly? With multicursor capability, TKE can make this editing task no longer a chore.
After creating the lines of code and duplicating them, hold the SHIFT and ALT/OPTION keys and click and drag a block selection on the numbers in each line. Once all numbers have been selected, select to the Edit / Insert / Enumeration menu option and enter the number “1” in the field at the bottom of the window followed by hitting the RETURN key. This will cause the first line to be numbered a decimal value of 1 and have each line be incremented by 1. Finally, hit the ESCAPE key to exit multicursor mode.
TKE also supports creating enumerated values for other bases besides decimal, including binary, octal and hexidecimal. Here’s a few other examples of how to specify the starting value (we’ll use our graphical example to show its effect).
- “32’dd10” => “This is line 32’d10. This is line 32’d11. This is line 32’d12…”
- “b0+2″ => “This is line 0. This is line 10. This is line 100…”
- “0oo6” => “This is line 0o6. This is line 0o7. This is line 0o10…”
- “0xxf-1″ => “This is line 0xf. This is line 0xe. This is line 0xd…”
- “16’hhf” => “This is line 16’hf. This is line 16’h10. This is line 16’h11…” (i.e., ‘x’ and ‘h’ both indicate a hexidecimal number)
By default, if nothing is entered in the number entry field and the RETURN key is pressed, a decimal value of 0 will be used as the starting value.
Special note for Vim users:
If you select the numbers using the “s” and “Shift-s” keys to cause multicursors to placed at the beginning of each number, you can use “dn” to delete the number and use “#” (pound key) to bring up the enumeration field. Super quick way to do this type of edit without touching the mouse.
So why risk repetitive strain injury? Use your time and keystrokes to get more complicated things done with TKE.
To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.