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.

How do I select specific range of lines in Notepad++ quickly? I have a text file that has over 1M of lines and I need to delete some fragments from it, but selecting lines manually just takes too much time. For example: I need to select lines from 2000 to 12000, how to make it quick?

share|improve this question
    
Similar question on Stack Overflow. –  trejder Dec 2 '13 at 11:06

3 Answers 3

up vote 1 down vote accepted

I got a better answer. You could record a macro ( deleting for example 10 lines ) . Then run it several times .

1) Go to Macro > Start recording

2) hold Shift and tap Down to mark for example 10 lines . And delete them.

3) Go to Macro > Stop Recording

Now your macro is recorded, you can save it for using in the future .

4) Go to Macro > Save Current Recording Macro... . And save it with a name .

5) Move cursor to line that you want to delete lines after that.Then go to Macro > Run A Macro Multiple Times... . And select your macro and run it N times that you want.

share|improve this answer
    
That's an idea! This may work, thank you a lot. :) –  Mcyg Mar 27 '12 at 23:37

Just Left Click once in line 2000 .then go to line 12000 , hold Shift and Left Click again .

1) Left Click in line 2000

2) Go to line 12000

3) Shift + Left Click in line 12000

share|improve this answer
1  
Yeah, but I lose selection with ctrl+G. That's what I'm talking about, going from 2000 to 12000 takes ages. –  Mcyg Mar 27 '12 at 23:01
    
For me @hamed solution works! Thanks. –  dario Nov 12 '12 at 9:59

I had just responded with this in this similar question, but it looks like a more fitting answer for here, and I'm guessing that this Question Title would get more hits... so, I'm posting here and hoping it isn't some kind of faux pas... (perhaps it should just be a link to the other?)

# File:: selectGOTO.py
#   A N++ Python Script to enhance line selection speed compared to mouse, cursor, page controls.
#   Selects text from the [ start|end ] of current line to [ end|start ] of GOTO line.

# Install using:: Plugins -> Plugin Manager -> Python Script
# Create script using:: Plugins -> Python Script -> New Script -> "selectGoto.py"
# Add to menu:: Plugins -> Python Script -> Configuration -> [select script] [ add ]
# Create shortcut:: [Restart N++]
#   Settings -> Shortcut Mapper -> Plugin Commands -> selectGOTO -> [modify] [ctrl]+[shift]+[g]

# Simple usage:
#   [ctrl]+[shift]+[g] line#
#   Do your operation... (ie: del)

from Npp import *

class startAnchor:
    pos = 0

def selectGOTO( args ):
    endPos = editor.getCurrentPos()
    if( endPos > startAnchor.pos ):
        startAnchor.pos = editor.positionFromLine( editor.lineFromPosition( startAnchor.pos ) )
    else:
        tmp = startAnchor.pos
        startAnchor.pos = endPos
        endPos = tmp
    endPos = editor.getLineEndPosition( editor.lineFromPosition( endPos ) )
    editor.setSel( startAnchor.pos, endPos )
    editor.clearCallbacks()

def main():
    startAnchor.pos = editor.getCurrentPos()
    editor.callback( selectGOTO, [SCINTILLANOTIFICATION.UPDATEUI] )
    notepad.menuCommand( MENUCOMMAND.SEARCH_GOTOLINE )

main()
share|improve this answer
    
Great! I've been looking for that for ages. However I edited your code so it doesn't move the initial selection point - there's no need to. (Removed code after if( endPos > startAnchor.pos )). –  Nigel Touch Feb 15 '13 at 12:47
    
I also created extra versions that select to Previous Bookmark (command 43007) and Next Bookmark (43006) that suit me better. –  Nigel Touch Feb 15 '13 at 12:51

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.