Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a fairly simple request, but I can't figure out how to do this in Notepad++. I need to create a list where each line begins with a number, starting from 1 and ending at 156. Obviously I dont' want to sit and type this in manually, as I will be creating more than one list.

1
2
3
.
.
.
.
156

How do I do that? I tried the macro function but it only plays back keyboard actions. It does not increment the sequence by 1 as Excel would do with its auto-fill feature. I know Excel can do it, but I must avoid using Excel.

a

As you can see I don't have any columns, or any lines of code. I am starting off from an empty document. I just want to create a long list in a text file.

share|improve this question
    
I had a look at "TextFX / TextFX Tools / Insert Line Numbers" and "Edit -> Column Editor" as discussed here. But that's not working for this type of situation. My situation is too simple. :) –  sammyg Feb 17 at 10:50
    
see this answer –  Raystafarian Feb 17 at 11:20

3 Answers 3

up vote 5 down vote accepted

In Notepad++ you can press Alt+C for the column / multi-selection editor and use the number to insert function from initial number increasing by 1, you'll just need to select all of your lines that you want to number.

You'll need to have blank lines already. I had to select the lines from the bottom up to the top before running the column editor, but I'm not sure if that's required.

essentially sourced from StackOverflow

share|improve this answer
    
I'm not sure you understood the situation. That's just it. It's a "column editor". I don't have any columns, or any lines of code. I am starting off from an empty document. I just want to create a long list in a text file. And if at all possible, I want to cheat using Notepad++ because I don't feel like typing in each number on each new line on and on. –  sammyg Feb 17 at 11:32
    
You need to have all your lines, highlight from the bottom to the top and then use the column editor. –  Raystafarian Feb 17 at 12:07
    
If you can expand your answer to include the bit about inserting new lines we discussed above, I will mark it as a solution. –  sammyg Feb 17 at 12:43
    
I added in what I mentioned –  Raystafarian Feb 17 at 14:01
    
As promised, I have marked your answer as the solution. Cheers! –  sammyg Feb 17 at 14:12

Answer provided by Raystafarian is essentially correct.

Please open a new document. Record a macro with only 'Carriage return'. Now play the macro 155 times. So you have 156 lines. Now follow the procedure suggested by Raystafarian.

share|improve this answer
    
Got it! That's essentially what I did. I just didn't use a macro to create new lines. And I didn't realize at first that I had to have the lines created first, to use the Column Editor. –  sammyg Feb 17 at 12:12
    
Thanks for the macro tip! It simplifies things a bit more. Just a small note, after recording the macro, you have to go back to the beginning of the first line. Then you play the macro 155 times. –  sammyg Feb 17 at 12:14
    
No, you don't have to go to the beginning of the first line. While recording the macro you have already created the first line. Now play the macro 155 times ( Option Run a macro multiple times ) to get the 156 ( 1 + 155 ) lines. Now ctrl + Home will get you to the beginning. –  Wishwas Feb 17 at 12:22
    
I don't think so. While on line 1, you start recording, press Enter, and you are on line 2. You stop recording. You go to "Run a macro multiple times" and play it 155 times. Your last line is 157. Because 2+155=157. So you have to either go back 1 line, or play the macro 154 times instead. –  sammyg Feb 17 at 12:30
    
OK, so I made the usual off-by-one error. –  Wishwas Feb 17 at 13:46

Bingo! I have found a way to do it using the Column Editor.

  1. Ctrl+N to create a new empty document.
  2. Go to Settings menu, Preferences, Editing, and make sure "display line number" option is enabled. Click Close.
  3. Press and hold Enter until you have reached line number 156.
  4. Ctrl+Shift+Home to select all the lines (i.e. "columns") from the bottom most to the one on the top. It is necessary to start from the bottom and go up with the selection, so that the text input cursor sits at the beginning of first line whilst everything else is selected down below.
  5. Alt+C to open the "Column / Multi-Selection Editor".
  6. Select "Number to Insert", type in 1 in "Initial number" and 1 in "Increase by". Select "Dec" for decimal numbers, and click OK.
share|improve this answer
    
I've removed the rather pointless comments here. The thing is – if someone answers your question, it's common for the OP to amend the answer to include some additional steps if necessary. Posting another answer is fine, but often quite redundant since other posts can (and should) be edited to be improved. –  slhck Feb 17 at 18:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.