Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I replace text in a selection?

Tags:

sublimetext2

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?

like image 782
user1419762 Avatar asked Jul 09 '12 22:07

user1419762


People also ask

What is the shortcut for replace the selected text?

Use the Ctrl + F keyboard shortcut to find the text that was replaced.


1 Answers

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.

enter image description here

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.

like image 146
Paul Pettengill Avatar answered Oct 12 '22 08:10

Paul Pettengill