Sublime Forum

Is it possible to quickly go the file of the found results from 'Find Results' window?


I wish to make Sublime Search All Text work similar to VS Code. Where I make a search and then from results I quickly go to the file where the matched string lives in so I can instantly make the edit.

In Sublime, I get the results in Find Results tab, but then I can’t even edit the file for changes.



So for example if I make a search for ll and get this :

I wish I could delete a line like this :

And then press save and the file would be edited.

I can’t do that for some reason. :disappointed:



You can’t edit directly in the find results, but you can:

  • Double click the file name to open that file for editing
  • Double click the line that has the match (line 49 in your example, it has a : after its line number) to open that file directly on that line for editing.


Thank you @OdatNurd

Is this possible to do this from the keyboard too?



You could try:



There’s no keyboard binding to do this by default, but with a little bit of customization it’s possible to add it (one of the great things about Sublime).

@kingkeith wrote a plugin for this, which you can find here. To use it, select Tools > Developer > New Plugin... from the menu and replace the sample text with the code from the link, and then save it as something like in the location that Sublime will default to.

Once you’ve done that, you can add a key binding like the following so that pressing enter while you’re inside of find results simulates a double click at the cursor location:

    "keys": ["enter"],
    "command": "double_click_at_caret",
    "context": [
        { "key": "selector", "operator": "equal", "operand": "text.find-in-files", "match_all": true },



This does not work for me. :disappointed:

I followed your instructions and named the plugin

I then entered this in keymap settings :

I also tried entering double_click_at_caret in place of command but that too didn’t work.

Thank you for any help.



Are you sure you saved the plugin file in a file with an extension of .py within your User package? That location is what Sublime defaults to if you use the above menu command to create the plugin view.

Does the Sublime Console (Ctrl+` or View > Show Console from the menu) display any error messages when you save the plugin or your key binding? If all is well, you should see it say something like reloading plugin User.double_click (what it says is based on the name of the python file) every time you save.



I get this error for some reason :

And the file is there :



Okay it started working. I think the issue was me not including the trailing comma. :confetti_ball:



Glad you got it up an running!

Regarding the error message you noticed above, that’s just telling you that your custom key binding file didn’t exist when you selected the menu item. Now that you’ve added the binding it won’t trigger that error unless you delete your key binding file.



@nikivi @OdatNurd I’m pretty sure F4 works by default to go to the file. You can be on any line above the next match and F4 will take you to the corresponding file. When you close the file, your cursor will be on the line. F4 will then take you to the next match.



Quite true, and those options are also available in the menu under Find > Find Results (which will show you the key binding if it happens to be different than the default).

Depending on your use case it can be handy to navigate through the find results that way if you want to visit all of the matches (especially in the case of a single match as in the OP). It can also be useful to quickly browse through the results and only jump to the files where you intend to do some editing as well.