Is there a shortcut key or single-step menu option to find and select all instances of a highlighted selection in Sublime Text?
-
5I thought that this was a to the point, clear, complete and specific. It answered exactly what I wanted to know. Thanks for a real question. Have an upvote... :) – rtfminc Jan 12 '13 at 01:13
7 Answers
On Mac OS you can use: CMD + CTRL + G

- 158,662
- 42
- 215
- 303

- 5,776
- 2
- 20
- 16
-
5I can not remember it. Some suggestion for good mnemotechnic? What `g` could stand for? – andilabs May 11 '14 at 10:11
-
20
-
7There are standard OS X commands for find next (⌘G) and find previous(⌘⇧G) in the Edit->Find menu. But I tend to think of them as get next and get previous so naturally ⌘^G is get all. – Andrew Hoos Jul 03 '14 at 08:15
-
46
-
3@andi "f" -> "find" "g" -> "find next" "g is _next_ to f" "cmd+shift+f" -> "find all" "cmd+ctrl+g" -> "get all" nevemind, that doesn't help – theRemix May 14 '15 at 02:22
-
-
1
-
1I don't know who invented pokemon `g`o. But we've gotta figure out how to get pokemon `g`o to the polls. – JacobIRR Feb 28 '18 at 22:27
-
-
More keyboard shortcuts: http://docs.sublimetext.info/en/latest/reference/keyboard_shortcuts_osx.html – Sam Oct 25 '19 at 14:58
On Windows/Linux press Alt+F3.

- 158,662
- 42
- 215
- 303

- 4,894
- 1
- 17
- 11
-
3just want to put out there that is uses the same case sensitive settings as __find__ or __find and replace__. I kept changing the class name as well as the instance name. :\ – Mathias Dec 12 '12 at 01:54
-
3@Mathias I've never understood the practice of using class and instance names that are identical in all but type case. I always feel like either the class name is too specific, or the instance name is too general and not descriptive enough. – coder543 Feb 28 '13 at 16:30
-
You know how hard naming actually is. It might seem like an easy task but I find myself struggeling with good names for both classes and instances a lot. I think the "instance is lowercase class name"-thing kind of makes sense. I mean - it gives you the type of the variable on first glance. The only annoying thing is if you have multiple of `TextField`. You can't name all of them `textfield` of course. So I admit that in some cases it's not specific enough (like TextFields) but if you are talking about controllers, I think it makes perfect sense eg `articleController = new ArticleController()` – Mathias Mar 01 '13 at 01:29
-
So in a way it really depends on the situation, but in general I think that the class name should already be a good description and therefore also fitting for the instance. BUT - obviously this is a question of tast much like: tabs vs spaces ... PS: Dear internet - I do not want to start another tabs vs spaces flame war here ... :) – Mathias Mar 01 '13 at 01:30
-
This doesn't seem to work for me, I highlight a section of code, Ctrl+I to start searching, borders around all search term within highlighted region, then Alt+F3, but it selects all matching terms in the file instead of just the region. – Joe Sep 02 '13 at 23:54
-
Alt-F3 for me opens up the menu at the top left corner (Linux Mint KDE) – hyper-neutrino Feb 19 '16 at 00:19
-
@oli thank you - and wow that's an unbelievable amount of reputation for such a simple answer ;) kudos – BenKoshy Aug 06 '16 at 12:25
-
-
@oli alt+F3 seems to select all instances of the selected part. for example, when highlighting 'foo', it would also select the first part in foobar (foo)bar. Is there a way to select only full words? – shahar_m Jan 16 '17 at 10:49
-
Alt + f3, this works fine for me but is there any way where I can just replace the word in a selected/highlighted content? – leonardeveloper Aug 08 '18 at 00:06
On Windows/Linux press Alt+F3.
This worked for me on Ubuntu. I changed it in my "Key-Bindings:User" to something that I liked better though.

- 158,662
- 42
- 215
- 303

- 433
- 4
- 6
-
8You shouldn't edit the defaults files, as they'll be overwritten on an update. Instead, copy the property to your "Key Bindings - User" file and edit it there, e.g. `{ "keys": ["ctrl+shift+g"], "command": "find_all_under" }` – LouieGeetoo Jan 16 '14 at 03:09
-
14This is a duplicate of an existing answer, and would be better suited as a comment. – dbn May 14 '14 at 02:13
-
1@dbw - I agree with you, but to the best of my knowledge there's no rule on SO that discusses what to do with duplicate answers. – ArtOfWarfare Sep 03 '14 at 15:11
-
2@dbw - It seems that the most appropriate thing to do with duplicate answers such as this one is to downvote them. So -1 from me. See this on meta: http://meta.stackexchange.com/a/226562/228219 – ArtOfWarfare Sep 03 '14 at 15:25
On Mac:
⌘+CTRL+g
However, you can reset any key any way you'd like using "Customize your Sublime Text 2 configuration for awesome coding." for Mac.
On Windows/Linux:
Alt+F3
If anyone has how-tos or articles on this, I'd be more than happy to update.

- 158,662
- 42
- 215
- 303

- 221
- 2
- 5
Note: You should not edit the default settings, because they get reset on updates/upgrades. For customization, you should override any setting by using the user bindings.
On Mac:
- Sublime Text 2 > Preferences > Key Bindings-Default
- Sublime Text 3 > Preferences > Key Bindings
This opens a document that you can edit the keybindings for Sublime.
If you search "ctrl+super+g"
you find this:
{ "keys": ["ctrl+super+g"], "command": "find_all_under" },

- 158,662
- 42
- 215
- 303

- 1,131
- 13
- 18
-
But don't make changes on `default` config files, as they are replaced on update & upgrades. Use `user` key binding files instead @dcryan22 – ilhnctn Dec 02 '16 at 14:26
-
@ilhnctn Right, you shouldn't edit these. You should override them in the `user` keybindings. I just posted the `default` binding to show what the key combination was. – d_coder Feb 10 '17 at 23:44
-
In the other posts, you have the shortcut keys, but if you want the menu option in every system, just go to Find > Quick Find All, as shown in the image attached.
Also, check the other answers for key binding to do it faster than menu clicking.

- 158,662
- 42
- 215
- 303

- 911
- 2
- 13
- 23
Even though there are multiple answers, there is an issue using this approach. It selects all the text that matches, not only the whole words like variables.
As per "Sublime Text: Select all instances of a variable and edit variable name" and the answer in "Sublime Text: Select all instances of a variable and edit variable name", we have to start with a empty selection. That is, start using the shortcut Alt+F3 which would help selecting only the whole words.

- 158,662
- 42
- 215
- 303

- 4,389
- 2
- 33
- 45
-
1This is great to know. `Alt+F3` without selection -> whole word. With selection -> precise match. – nh2 Oct 29 '16 at 20:47