9

I'm stuck with a bit of an Xcode puzzle: how can I find and replace either in a selection I've made, or at least just in a single file?

According to the following topic there's a way to hold down the option key and Replace All should change to Replace in Selection:

How can I find and replace inside a selection in Xcode?

This either doesn't happen in Xcode 4.5, or I don't know how to do it. Right now I can bring up the find/replace option in the search navigator on the left, then hit return to search, or hit preview to bring up which files are to be changed.

As a workaround, I can search in a selected group (by right-clicking on a group in the file navigator), but being able to replace in a selection I've made, and in a single file would be extremely helpful.

Thanks in advance ;-)

Community
  • 1
  • 1
Jay Versluis
  • 2,062
  • 1
  • 19
  • 18

1 Answers1

13

In Xcode 4.6 (I don't have 4.5 on my system any more to check it), if you are in the editor window and press Cmd-F to bring up the Find view at the top of the editor (as opposed to the global search inspector you are referring to), and use the Replace option in it, holding down the Option key changes "Replace All" to "In Selection". This seems reasonable since the global search inspector is across multiple files while the option to choose "In Selection" really only makes sense when you are referring to a single file.

Dave Reed
  • 261
  • 3
  • 5
  • Thank you so much - I've been looking for ages for this! Good old CTRL-F - who would have thought, this is exactly what I was looking for. – Jay Versluis Mar 01 '13 at 15:08
  • I suspect you accidentally said Ctrl-F when you meant Cmd-F as what I said in my answer about it being Cmd-F is correct. – Dave Reed Mar 03 '13 at 17:40