Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using Notepad++ how can i make a macro type situation in which a number increments?

for example i have about 500 lines. in the beginning of each line i want to add a number. so in line 1 i would want "1)" and then line 2 i would want "2)"

i know i can do a macro in n++, but it wouldn't be incremental. is there any possible way to do this?

like image 459
Bilal Avatar asked Jan 27 '10 20:01

Bilal


People also ask

Can you make a macro in Notepad?

To record a macro, select Macro > Start Recording or press the button on the toolbar. Notepad++ will now keep track of the changes you make on a document or certain actions you perform. To stop recording, select Macro > Stop Recording or select the button on the toolbar.


2 Answers

Edit -> Column Editor and use the bottom option on that dialogue (Number to Insert). This way you can also start from whatever number you like and not have to have the leading zeros.

like image 188
Tom Saleeba Avatar answered Sep 19 '22 03:09

Tom Saleeba


Notepad++ Macros only playback keyboard actions. They can't do anything dynamic.

However there is a built-in(?) plugin that can do this for you.

Highlight all the code, then choose "TextFX / TextFX Tools / Insert Line Numbers"

One thing to be aware of is that it is the absolute line number within the file. You can't start numbering on line 10 and make it say line 03 or something like that.

like image 23
Great Turtle Avatar answered Sep 18 '22 03:09

Great Turtle