Skip to content

A Visual Studio Extension that selects the next occurrences of the current selection and adds multiple cursors for editing

License

Notifications You must be signed in to change notification settings

leachdaniel/SelectNextOccurrence

 
 

Repository files navigation

Build status

Select Next Occurrence

Download this extension from the VS Gallery or get the latest CI-build.


This extension makes it possible to select next occurrences of a selected text for editing.

Aims to replicate the Ctrl+D command of Sublime Text for faster coding.

See the change log/roadmap for changes and Roadmap.

Features

  • Select next occurrence of current selection
  • Select next exact occurrence (overrides Find-dialog)
  • Select previous occurrence
  • Select previous exact occurrence (overrides Find-dialog)
  • Select all occurrences
  • Convert a selection into multiple cursors
  • Skip occurrence
  • Undo occurrence
  • Add caret above/below
  • Use multiple carets to edit
    • Alt-Click to add caret

Select Next Occurrence


Options

  • Toggle case-sensitive search by using the "Match case" setting from the find-dialog (Ctrl+F)

  • Toggle match-whole word search by using the "Match whole word" setting from the find-dialog (Ctrl+F)

  • Deactivate Alt-Clicking to add carets in options-dialog

Select Next Occurrence Options dialog


Key-bindings

Go to Tools -> Options -> Environment -> Keyboard and search for these command names to edit at your choice. Make sure the Use new shortcut in is set to: Text Editor

Command (prefix SelectNextOccurrence.) Recommendation
SelectNextOccurrence Ctrl+D
SelectNextExactOccurrence
SelectPreviousOccurrence Ctrl+E
SelectPreviousExactOccurrence
SelectAllOccurrences Ctrl+K, Ctrl+A
SkipOccurrence Ctrl+K, Ctrl+D
UndoOccurrence Ctrl+U
AddCaretAbove Ctrl+Alt+Up
AddCaretBelow Ctrl+Alt+Down
ConvertSelectionToMultipleCursors Ctrl+Shift+I or Alt+Shift+I (vscode))

Select Next Occurrence Keyboard bindings


Troubleshooting

  • Nothing happens when pressing assigned keys

Check that the key-bindings are correct and that the Use new shortcut in is set to: Text Editor.

  • Nothing happens when ALT + left-clicking mouse button to add new caret, multiple edits are unresponsive

There is a possibility that other plugins use this functionality too, and a conflict occurs. Please check for other installed plugins with this feature and try to disable.

  • Copy/cut multiple occurrences doesnt work as expected

There is a conflict with the extension Copy As Html, if you have this enabled, try to disable it and see if this helps.


Contribute

Check out the contribution guidelines if you want to contribute to this project.

For cloning and building this project yourself, make sure to install the Extensibility Tools 2015 extension for Visual Studio which enables some features used by this project.

As far as I know you must have a 2015-edition of VS installed (or previously installed) to get the generators working for Extensibility Tools in 2017.

License

Apache 2.0

About

A Visual Studio Extension that selects the next occurrences of the current selection and adds multiple cursors for editing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%