10

In the Sublime Text 2 "Find in Files" results, a box is drawn around wherever your search term appears. Double clicking within that box opens the file and focuses your cursor on that line.

Is there any way to achieve this using only your keyboard?

I understand you could use cmd+p to open file then ctrl+g to goto line, but I was hoping there was a single combo you could use to go directly to the result, like the double click offers.

7

Normally F4 & Shift + F4 are used for cycling through found results. But if you set your cursor position to one line upper of what you want to go and press F4 it opens the file and sets your cursor position to start of that line.

And if you want to change shortcut put this in your "Default (OSX).sublime-keymap" file in User directory and change F4 to shortcut you want:

{ "keys": ["f4"], "command": "next_result" }

Edit: Just noticed Shift + F4 goes to right result (as long as cursor is not at first column of line. In that case previous result shows up) even if your cursor is 'at' the results itself. So that's better for this question.

Second edit: "User" directory is "/Users/Username/Library/Application Support/Sublime Text 2/Packages/User" which also can be accessed through Sublime Text 2 (Command Palette (Super + Shift + P) or through menu (Sublime Text 2 > Preferences > Browse Packages...))

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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