如何选取数千行

如何选取数千行

我有一个包含 200,000 行的文本文件。如何在删除之前选择多行?

对于 65,000 行来说,手工工作太困难了。

答案1

最简单的方法:

Ctrl+ G,转到第 1 行

    Menu > Edit > Begin/End select.

Ctrl+ G,转到第 65.000 行。

    Menu > Edit > Begin/End select.

现在您已经选择了范围。


回答:

https://stackoverflow.com/questions/8490968/select-range-of-lines-in-notepad

答案2

对于数千行/页面来说,shift+组合键的速度相当慢;所以这里有一个some direction control快速地解决方案...

# 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()

答案3

按住 Shift 和 PageDown 可以相当快速地选择多行。

相关内容