starting the Line number with 0

  • i need notepad++ to start the line Count Margin with 0 so that it’s start counting By 0 and not by one 1(sry i dont know it’s name :3)

    i know it sounds silly but im using a personal language based on GoTo instead of : { }, so every time i have to make that Line-- in my head and after 3 years of doing this it would be realy cool if the line counting margin would start with 0

  • @themine702

    It seems to me it is not possible to set the starting line count for line numbers.
    One option is to set a text margin and fill it in.
    But it will require you manually reset the numbers each time you edit the document.
    Here is a PythonScript solution:

    editor.setMarginWidthN(3, 48)	# set last margin width
    editor.setMarginTypeN(3, 4)		# set last margin type to text
    total = editor.getLineCount() 		#  get lines total 
    for i in range (0,total):
    	mark = str(i)
    	editor.marginSetText(i, mark)

    If that works for you, then you can try to setup some event watch,
    so that happens automatically each time the document is edited.
    Auto filling might be tricky to get it work, or slow down the editor.
    I would try to watch for an event which fires when the total line
    count chages, but I am not sure about how exactly to do it.

    Or just reset run the fill when you save the document.

  • Just tested it, and it is really slow so better not do this if
    you have big files, it can hang NPP

  • @themine702
    By the way, why can’t you just use default numbering from 1?
    For example you have a file :
    (1) A+B
    (2) goto 1

    And then just use a script to save the file with appended line:
    (0) ; empty line
    (1) A + B
    (2) goto 1

    Or just pass the the compiler the file with appended “’\r\n” in the beginning.
    Or am I missing something?

Log in to reply