Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to select text and then use "search and replace" to replace strings in this selection.

I think the following workflow should be it:

  1. Select Text
  2. Ctrl+H to activate "search and replace"
  3. type the search term
  4. Tab or click in replace textbox
  5. type the replace term
  6. do the search and replace operation

However, when one of the text boxes already contains text than my text selection is deselected. This happens whenever I try to use search and replace.

How can I prevent Sublime from deselecting my selected text?

I already found following ressources, but they didn't help preventing the deselecting.

share|improve this question
Got the same issue and I can't quite understand how the three friends who recommended Sublime Text to me missed that obvious shortcoming. Probably we're looking for the wrong search terms or something. +1 – 0xC0000022L Oct 31 '14 at 1:19

I'm not sure if this works on every platform, but (in the Linux version at least) even though the text no longer appears selected, the search/replace module(?) seems to know where the text was selected.

You can click the "In selection" control (the right-most button just to the left of the "Find What:" box - the icon is a dark rectangle with a light centre) and the search/replace will occur only in the text that was selected when you invoked it.

Unfortunately, the text stays deselected after you perform this operation, so you have to select it again if you want to do another operation in that same text, so it's still not great.

I'm assuming this is a feature that the developers don't actually use themselves (or maybe they don't even use their own product to develop it?) or it would have been fixed long since.

This may be more recent functionality than the date of your post (I'm using build 3065).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .