Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kevin-d-omara/4f0657917ff3b73aa9d17dc208a17a1d to your computer and use it in GitHub Desktop.
Save kevin-d-omara/4f0657917ff3b73aa9d17dc208a17a1d to your computer and use it in GitHub Desktop.
AddCursorToEveryInstanceOfHighlightedText.py
"""
# Summary
Add a separate cursor to every place where the currently highlighted text is found.
# Usage
1. Select a piece of text.
1. On the toolbar, click: Plugins > Python Script > Scripts > AddCursorToEveryInstanceOfHighlightedText
# Requirements
1. Notepad++ v8.6 or higher. (Otherwise, manually enable Multi-Select in Settings > Preferences > Editing).
1. Enable the "PythonScript" plugin: Plugins > Plugins Admin
1. Add this script to the correction location:
1. Plugins > Python Script > New Script > AddCursorToEveryInstanceOfHighlightedText.py
1. Copy-paste this script into the new file.
1. Save.
# Attribution
Author: Ekopalypse @ https://community.notepad-plus-plus.org
Source: https://community.notepad-plus-plus.org/topic/19116/multi-cursor-editing/12?_=1705618554172&lang=en-US
Copied: 2024-01-18
"""
from Npp import editor
first_line = editor.getFirstVisibleLine()
editor.setTarget(0, editor.getTextLength())
editor.multipleSelectAddEach()
editor.rotateSelection()
editor.setFirstVisibleLine(first_line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment