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 \
I know this has been answered many times, and all are correct, but I though I would add another:
Similar to the Ctrl - D method to select individual occurrences of the current selection, you can select all occurrences in the file with Alt+F3 when using Windows or Linux (CMD+CTRL+G in Mac world).
This is helpful for mass-changes.
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".
Windows
1- Find: CTRL + F
2- Select-in: Alt + Enter
Now you can change all the selection in one shot like "seen-on-tv" ST homepage Spot.
Credit goes to : https://superuser.com/a/921806/342825
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...
This frustrated the heck out of me, and none of the above answers really got me what I wanted. I finally found the answer I was looking for, on a mac if you do ⌘ + option + F it will bring up a Find-Replace bar at the bottom of your editor which is local to the file you have open.
There is an icon option which when hovered over says "In Selection" that you can select to find and replace within a selection. I've pointed to the correct icon in the screenshot below.
Hit replace all, and voila, all instances of '0'
will be replaced with '255'
.
Note: this feature is ONLY available when you use ⌘ + option + F.
It does NOT appear when you use ⌘ + shift + F.
Note: this will replace all instances of '0'
with '255'
. If you wanted to replace 0
(without the quotes) with 255
, then just put 0
(without quotes) and 255
in the Find What:
and Replace With:
fields respectively.
Note:
option key is also labeled as the alt key.
⌘ key is also labeled as the command key.