27

In Sublime, after I do one 'replace all', the find/replace text boxes at the bottom of the screen disappear. I often do multiple replace alls, so I want the boxes to stay there / persist until I explicitly close them. I feel like I have gotten this to work in the past, but can't find a way to get back to it.

5
  • 2
    This is an important question, I have been trying to do the same thing!
    – vgoklani
    Jan 18, 2013 at 17:01
  • Have you tried reinstalling Sublime?
    – chuff
    Jan 18, 2013 at 19:50
  • 1
    Yes. The default behavior seems to be: for a single find or replace, the boxes do not close. But after a Find All or Replace All, they do, even after reinstall. It gets very annoying to have to reopen the box. I just want it to sit there for the whole editing session.
    – scharfmn
    Jan 18, 2013 at 20:01
  • 1
    I am genuinely curious, what's the benefit of those boxes sitting there all the time? You can always bring them up with ctrl+f, ctrl+i, ctrl+h, ctrl+shift+f or whatever else, and they don't loose values if you close them.
    – enrey
    Jan 20, 2013 at 20:22
  • I'm kind of a mouse addict, and I don't like having to click up there every time to bring it back. I guess I'm just going to have to get off the drugs.
    – scharfmn
    Jan 22, 2013 at 21:30

6 Answers 6

16

UPDATE (2022): This is 7,5 years old answer (2015). A lot things changed in Sublime Text since then. Please, bare in mind that for the newest versions of this editor, the following answer provides partial solution only and some other steps must be undertaken. Details can be found in comment below.

This is tested only in Sublime Text 3, but should work in ST2 as well:

  1. Select Preferences > Key Bindings -- Default.

  2. Search for ctrl+alt+enter and copy entire block.

  3. Select Preferences > Key Bindings -- User.

  4. Paste copied block anywhere and remove , "args": {"close_panel": true} part from it.

  5. Save Key Bindings -- User and test it (you don't need to restart Sublime Text).

Since you have modified just the key binding, you should remember, that expected behavior will work only if you execute Ctrl+Alt+Enter inside search & replace panel.

If you click Replace All button, the "old" behavior will be applied -- i.e. panel will be closed.

2
  • 4
    So 'Replace All' still closes the panel? Is there a solution to keep the panel open all the time? I do multiple search/replace-all operations across many files and I also find the constant open-close tiresome.
    – cbmtrx
    Nov 27, 2017 at 14:29
  • 1
    As of early 2023, this is part of the solution if you want the panel to stay open regardless of whether you use the buttons or hot-keys. The OP did not specify a single method of execution for the find-and-replace-all, so trejder's answer here is currently 50% of the solution
    – mOrloff
    Jan 5 at 20:23
9

On the latest version of sublime, these settings can be turned off as desired in your preferences.

// This determines whether the find panel is closed when the "Find All" // or "Replace All" buttons are pressed. Note this does not change the // keybinding behavior. "close_find_after_find_all": true, "close_find_after_replace_all": true,

simply go to Preferences->Settings and add this line in the right side window "close_find_after_replace_all": false,

enter image description here

3
  • Changed accepted answer to reflect new preferences setting
    – scharfmn
    Nov 25, 2021 at 1:30
  • This is a PARTIAL ANSWER. The OP did not specify a single method of execution for the find and replace all, so trejder's answer is still 50% of the solution. If you are looking to remedy this behavior for your installation, be advised that you may need to apply both answers.
    – mOrloff
    Dec 28, 2022 at 19:09
  • Simply just what I needed. Many thanks!
    – Lod
    Feb 26 at 19:56
5

Update Dec-2021: See answer by user 'beginner'; will leave this for historical purposes but that answer should be the accepted solution; apparently the feature was finally added in build 4092.

I too was looking for this (7 years later!). I also looked through the settings and tried to search on sublime forums and google... but trejder's answer appears to be only option that currently exists.

Since I didn't see any requests for it, I went ahead and created a feature request over on the sublime forums for this.

Hopefully, it will either be accepted or some forum guru will tell me I'm an idiot and the feature already exists. Posting the link mainly so any other souls wandering in from search engines might be able to check if there have been any updates.

Cross your fingers :-)

1
  • Thank you! They listened to you! Dec 7, 2021 at 15:37
3

Edit: see accepted answer

This was a workaround before the accepted answer appeared:

command+shift+f on the Mac. (Probably ctrl+shift+f for non-Mac.)

Leave the "Where" box blank for current file only, or a path to a parent folder to do everything within parents and children.

Click "Find." An alert will ask if you want to replace all occurrences.

Tested on Sublime 3 only.

1
  • The syntax is <current file>. It's my preferred method for replacing.
    – Ste
    Nov 28, 2019 at 10:10
1

There are two different types of search panels that you can use in Sublime Text 2. There is the regular search and the incremental search. The major difference between these two search panels is the behavior of the Enter key. In the regular search panel, enter moves to the next instance and in the incremental search panel the enter key finds the first instance and then closes the panel.

The short cut keys for Windows are as follows:

  • Ctrl + F: Regular Search
  • Ctrl + I: Incremental Search

This site has more information about searching and replacing in Sublime Text 2 if you're interested:

http://docs.sublimetext.info/en/latest/search_and_replace/search_and_replace.html

3
  • My question: is there a way to make the full find/replace sit there, no matter what you do with it, on demand?
    – scharfmn
    Jan 18, 2013 at 23:09
  • If I'm not mistaken, the regular search should do that. Is that the one that you've been using?
    – tayopi
    Jan 18, 2013 at 23:18
  • It is, yes. Regular find (or replace) will stay put after a once-only find, or a once-only replace. But not after a Find All or Replace All. I believe there's a way to get the latter.
    – scharfmn
    Jan 18, 2013 at 23:45
1

I use mscharfs' method for large documents but use this workaround for smaller docs.

  1. Placing your cursor exactly to the left or the right of the word at its boundary.
  2. Hold down the keyboard short Ctrl+D (expand selection to word) until the selection cannot go any further.
  3. Start typing the replacement.

That text (or selection) has been replaced.

Note: Placing your cursor at the word boundary behaves differently in the sense that it matches the word exactly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.