オープンソースのNotepad ++で次の機能を使用する方法を探しています。
を押すとSublimeText Ctrl + D (マック: cmd + D 私は思う)これは起こる:
次に、変更可能な単語を複数選択し、実際にこれらの場所をすべて選択します(select-allではありません)。
Notepad ++でこれを行う方法はありますか(おそらくAutohotkeyの助けを借りて)?
オプション:Sublimeでは、これらのそれぞれを元に戻すこともできます Ctrl + Dと Ctrl + U との発生をスキップします Ctrl + K。
私はこのスレッドをNotepad ++ Communityページで見つけました:
https://notepad-plus-plus.org/community/topic/11360/multi-selection-and-multi-edit
彼らは python script plugin を使用して、次のスクリプトでこの機能を作成しています。
# this script implements the enhanced multi cursor edit functionality
def default_positions():
return 0, editor.getLength()
def get_pos_of_bookmarks():
npp_bookmark_marker_id_number = 24
npp_bookmark_marker_mask = 1 << npp_bookmark_marker_id_number
_start_position, _end_position = default_positions()
line_nbr = editor.markerNext(_start_position, npp_bookmark_marker_mask)
if line_nbr != -1:
_start_position = editor.positionFromLine(line_nbr)
line_nbr = editor.markerNext(line_nbr + 1, npp_bookmark_marker_mask)
if line_nbr != -1:
_end_position = editor.getLineEndPosition(line_nbr)
return _start_position, _end_position
def get_pos_of_visible_lines():
first_visible_line = editor.getFirstVisibleLine()
_start_position = editor.positionFromLine(first_visible_line)
lines_visible = editor.linesOnScreen()
last_visible_line = editor.docLineFromVisible(first_visible_line+lines_visible)
_end_position = editor.getLineEndPosition(last_visible_line)
return _start_position, _end_position
def get_pos_of_selections():
_start_position, _end_position = default_positions()
if editor.getSelections() == 2:
_start_position = editor.getSelectionNStart(0)
_end_position = editor.getSelectionNEnd(1)
return _start_position, _end_position
area_dict = {'a':default_positions,
'b':get_pos_of_bookmarks,
's':get_pos_of_selections,
'v':get_pos_of_visible_lines}
editor.beginUndoAction()
def Main():
_text = editor.getTextRange(editor.getSelectionNStart(0), editor.getSelectionNEnd(0))
if len(_text) != 0:
_current_position = editor.getCurrentPos()
_current_line = editor.lineFromPosition(_current_position)
_current_Word_start_pos = editor.getLineSelStartPosition(_current_line)
_current_Word_end_pos = editor.getLineSelEndPosition(_current_line)
find_flag = 2 # 0=DEFAULT, 2=WHOLEWORD 4=MATCHCASE 6=WHOLEWORD | MATCHCASE
mode_options = ' 0=replace, 1=before, 2=afterwards\n'
area_options = ' a=all, b=bookmarks, s=selected, v=visible'
expected_results = [x+y for x in ['0','1','2'] for y in ['a','b','s','v']]
result = notepad.Prompt(mode_options + area_options, 'Choose the desired option', '0a')
while result not in expected_results:
if result is None:
return
result = notepad.Prompt(mode_options + area_options, 'Choose the desired option', '0a')
chosen_mode, chosen_area = result
area_start_position, area_end_position = area_dict[chosen_area]()
if chosen_mode == '0': # replace whole string version
editor.setEmptySelection(_current_position)
position_Tuple = editor.findText(find_flag, area_start_position, area_end_position, _text)
while position_Tuple is not None:
if _current_position not in position_Tuple:
editor.addSelection(*position_Tuple)
position_Tuple = editor.findText(find_flag, position_Tuple[1], area_end_position, _text)
Elif chosen_mode == '1': # insert before selected string version
editor.setEmptySelection(_current_Word_start_pos)
position_Tuple = editor.findText(find_flag, area_start_position, area_end_position, _text)
while position_Tuple is not None:
startpos, endpos = position_Tuple
if startpos != _current_position and endpos != _current_position:
editor.addSelection(startpos, startpos)
else:
_current_Word_start_pos, _current_Word_end_pos = startpos, startpos
position_Tuple = editor.findText(find_flag, endpos, area_end_position, _text)
Elif chosen_mode == '2': # insert after selected string version
editor.setEmptySelection(_current_Word_end_pos)
position_Tuple = editor.findText(find_flag, area_start_position, area_end_position, _text)
while position_Tuple is not None:
startpos, endpos = position_Tuple
if startpos != _current_position and endpos != _current_position:
editor.addSelection(endpos, endpos)
else:
_current_Word_start_pos, _current_Word_end_pos = endpos, endpos
position_Tuple = editor.findText(find_flag, endpos, area_end_position, _text)
# now add the current selection
editor.addSelection(_current_Word_start_pos, _current_Word_end_pos)
Main()
editor.endUndoAction()
あなただけを打つことができます F3 検索を続行します。