Sublime Forum

Find/Replace All Text on Page via Keyboard

#1

I often want to “replace this string here with that string there everywhere”. In TextMate, I can:

  1. Select Find String
  2. Cmd-E
  3. Select Replace String
  4. Cmd-Shift-E
  5. Cmd-Ctrl-F (Replace All)

Sublime has Ctrl-E and Ctrl-Shift-E (yay!), but I can’t find a way to perform Replace All from the keyboard. If I follow the steps above but substitute “Ctrl-H” for Step 5, the currently-selected-text (the replacement string) becomes the Find string when the pane comes up. Ouch! And in Sublime Text 2, Ctrl-Enter no longer performs the Replace All.

How can I most easily invoke Replace All (ideally without even needing to open the find/replace pane)?

0 Likes

#2

To replace all from the “find and replace” panel: press alt + enter

for a reference of all keyboard shortcuts for the find and replace panel, check out this post: viewtopic.php?f=3&t=2555&start=0&hilit=replace+all

0 Likes

#3

Another option:

  1. Select the text
  2. Press Control+Command+G (Find/Find All Using Selection)
  3. Type the replacement text, and everything will be updated simultaneously
0 Likes

#4

[quote=“jps”]Another option:

  1. Select the text
  2. Press Control+Command+G (Find/Find All Using Selection)
  3. Type the replacement text, and everything will be updated simultaneously[/quote]

Yep, this is very good stuff. A quick “replace all” suitable for many common cases, like renaming a variable.

0 Likes

#5

[quote=“jps”]Another option:

  1. Select the text
  2. Press Control+Command+G (Find/Find All Using Selection)
  3. Type the replacement text, and everything will be updated simultaneously[/quote]

This looks like a great workflow to get used to. What’s the keyboard shortcut/command for this on Windows under Sublime 2?

0 Likes

#6

It’s Alt+F3 on Windows and Linux - there’s an entry for it in the Find menu.

0 Likes