Sublime Forum

After find-and-replace, return to start/last replacement

#1

Hello. I’ve got a common usage scenario of the find-replace dialog, which is not entirely convenient and/or correct, so I would like to adjust and improve it.

Suppose I have a python file with a class and several methods within. When I want to rename some variable in one of the methods, I invoke “Replace” command, type in the search string and the substitute, and hit Replace button a few times. Since I only need to replace the variable within one method only, I stop at some point, usually when I reach another method. Now, how do I return to the position of the last replacement, or, ideally, to the position from which I started the replacements from? If i hit Undo, I do return to the last replacement, but it is undone, and I have to re-edit it. Also, it would be great if it wasn’t python specific, and would work with, say, regular text or css.

0 Likes

#2

If you press BackSpace to delete the Find term, does it return to the most recently replaced text?

There is also the Find menu/ Use Selection for Replace which might prove helpful. That is, highlight the method text before using Replace.

0 Likes

#3

Thank you, deleting the find term does indeed put me back to where the caret was before I started the replacements, which is perfect (or so it seems). It is a bit cumbersome, though, but good enough. Pre-selecting the whole method would be inconvenient in my case, because my code often doesn’t fit in one screen, and repeated selecting with either mouse or keyboard would be a pain.

0 Likes