Answers:
我得到了一个更好的答案。您可以记录一个宏(例如删除10
行)。然后运行几次。
1)前往 Macro > Start recording
2)按住Shift并点按Down以标记示例10
线。并删除它们。
3)前往 Macro > Stop Recording
现在您的宏已被记录,您可以将其保存以备将来使用。
4)前往Macro > Save Current Recording Macro...
。并保存一个名称。
5)将光标移到要删除的行上,然后转到Macro > Run A Macro Multiple Times...
。并选择您的宏并运行所需的N
时间。
我刚刚在这个类似的问题中对此做出了回应,但是它看起来似乎是一个更合适的答案,而且我猜想这个问题标题会获得更高的点击率...所以,我在这里发布,希望它不是某种人造假的……(也许应该只是另一个的链接?)
# 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()