Mar 05, 2013
SyncEdit allows you to refactor words in your code in a more flexible manner than that found in the default editor. The user first highlights a range of code, then selects any word within that range and begins editing. All other occurrences of that word within the selection will simultaneously update. Whereas the default rename refactoring works against only recognized variables, SyncEdit works against any word, regardless of it usage. SyncEdit can do things like change the visibility of several methods at once from public to private or easily comment out multiple System.out.println statements across multiple methods as long as they are included in the selection. This is version 2 of the original SyncEdit plugin created by Nathan Brown. It has not been updated since 2006 and has not worked cleanly since IntelliJ IDEA version 9. I have to patched it and I hope to add additional functionality but for now it is mostly an updated release of the original code. The first version had no published license and attempts at contacting the author were unsuccessful so I have simply updated the freely available version and am releasing it as an open source plugin.
A "SyncEdit Mode" menu item is added to the Search and Editor Popup menus. Simply select a range to be edited, enter "SyncEdit Mode" and all words in the marked range become 'live' - any changes to an instance of a word changes all matching strings in real-time.
When in SyncEdit mode, pressing TAB/Ctrl+TAB will take you forward to the next/previous SyncEditable word found, respectively.
The decision about the word to SyncEdit is determined by a 'Select Word' type operation at the current cursor location (respecting any CamelHump settings) when a modification is made. However, you can SyncEdit a custom region of text by first selecting it and then invoking the SyncEdit action again, or even just start typing to replace the substring completely.
There is also a "Paste with SyncEdit" action added to the Edit Menu - this will execute a paste and automatically enter SyncEdit Mode for the range of the pasted text, great for tweaking pasted code fragments for the context they are used in.
The mode can be exited by pressing either escape or enter - once to exit SyncEdit on a word, and once again to stop SyncEditing a range. The colors used by the SyncEdit plugin can be customised on the Plugins tab of the editor Colors & Fonts settings.
Recent change notes
- 2.0.2 - Added settings panel with option to enabled/disable syncedit feature and to switch between using global/word selection. Fixed bug where syncedit would not stay active if multiple intellij windows were open at the same time.
- 2.0.1 - Fixed issue with preventing multiple selections. Fixed default coloring and default mode keystroke. Fixed errors for unusable selections. Reactivating syncedit outside selection now toggles off syncedit mode. Updated to work in other JetBrains platforms (AppCode, WebStorm, etc)
- 2.0.0 - Changing version to correspond with name. Now works with multiple project windows open. Refactors whole words only now instead of words and substrings in other words.
- 1.0.0 - Initial version directly built upon SyncEdit originally created by Nathan Brown (last updated 2006)