Selecting range of lines in Notepad ++
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?
Solution 1:
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.
Solution 2:
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
Solution 3:
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()