I've just started using Sublime Text 2, coming from emacs.
I have a region of text selected. Within that region, I'd like to replace all text instances of '0' with '255'.
How do I do this kind of text replacement?
I've just started using Sublime Text 2, coming from emacs.
I have a region of text selected. Within that region, I'd like to replace all text instances of '0' with '255'.
How do I do this kind of text replacement?
You can use ctrl+F to find the text.
ctrl+h to enter the replacement text. Then ctrl+shift+h to replace the current selected text and move to next matched text.
This is for windows. But you can check in mac also for which you might want to check the key bindings under Preferences.
As @JOPLOmacedo stated, ctrl + F is what you need, but if you can't use that shortcut you can check in menu:
and there you have it.
You can also set a custom keybind for Find going in:
As your request for the selection only request, there is a button right next to the search field where you can opt-in for "in selection".
1)
Ctrl + F
(orCmd + F
on a Mac);2) Enter the string you want to find on the input at the bottom of the window.
3) Press "Find All";
All of the appearances are now selected. Do whatever you want.
Aside
There are a bunch of options at the left of the input that opens on
Ctrl + F
. There's one that says something like "Find in selected text". Select a bunch of text, check that option and repeat the same steps above starting from 2). Now, only matches belonging to that selection are selected.Select the item you want to replace (double-click it, or Ctrl - F to find it)...
Then do a (Ctrl - Apple - G) on Mac (aka. "Quick Find All"), to HIGHLIGHT all occurrences of the string at once.
Now just TYPE your replacement text directly... All selection occurrences will be replaced as you type (as if your cursor was in multiple places at once!)
Very handy...
On a Mac you can can select the text that you are after then press: cmd + ctrl + G
This will select every instance of your selected text within the same document. If you now start typing to replace your original highlighted text, you will replace all of the other occurrences at the same time.