Sublime Forum

Window.showReplacePanel()

#1

window currently has functions for showing the quick panel and the input panel with prefilled text. I would like to request adding a function to show the replace panel (and logically, the file panel as well, but I’m mainly interested in the former), with arguments indicating which options (regex, case-sensitive, etc.) should be turned on or off, initial text for the pattern and replace field, and which of those two the cursor starts in.

The use case for this is adding a poor man’s ‘rename identifier’ feature. Position cursor over identifier, hit the keyboard shortcut, show the replace panel with a pattern of (?<=\b)identifier(?=\b) and regex turned on, type new name and hit replace all, with the advantage of being able to preview the changes. We of course already have the findUnder command which is similar, but this does not take into account word boundaries, meaning that, for example, renaming the variable ‘ring’ to ‘circle’ will replace all your string types with the non-existent stcircles.

0 Likes

#2

Might be useful to attach something like this to Shift+Alt+F3, because it’s similar to Alt+F3, just taking into account word boundaries.

0 Likes

#3

I was thinking ctrl+r, but to each his own keybindings :smile:

0 Likes