Ctrl + D in SublimeText is "Quick Add Next." This appears to be equivalent to Ctrl + B in Brackets, which is "Add next match to Selection" on the Find menu.
In Sublime Text, you can quickly jump to any line in the code. Hit Ctrl–G (Mac and Windows). Type in a line number and hit Return/Enter to go to that line.
The Goto Anything shortcuts navigate the current file. If you have a project open, you can press Ctrl ⇧ R to launch Goto Anything In Project. This command will search for symbols across every file in your project.
Sublime Text works with all the standard Windows shortcuts: In addition to the arrow keys, home, end, page up, etc, there is: Ctrl+Left / Ctrl+Right: Move by words. Ctrl+Home / Ctrl+End: Move to the beginning / end of the file. Ctrl+L: Expand selection to line.
Try Shift+F4 (fn+Shift+F4 on the Aluminum Keyboard).
It appears a plugin has been created to do this. Took a quick look, there are some additional features in the plugin. While my original answer below will work, it will be much easier to install an existing plugin.
https://sublime.wbond.net/packages/BetterFindBuffer
Doable with a plugin.
import sublime
import sublime_plugin
import re
import os
class FindInFilesGotoCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
if view.name() == "Find Results":
line_no = self.get_line_no()
file_name = self.get_file()
if line_no is not None and file_name is not None:
file_loc = "%s:%s" % (file_name, line_no)
view.window().open_file(file_loc, sublime.ENCODED_POSITION)
elif file_name is not None:
view.window().open_file(file_name)
def get_line_no(self):
view = self.view
if len(view.sel()) == 1:
line_text = view.substr(view.line(view.sel()[0]))
match = re.match(r"\s*(\d+).+", line_text)
if match:
return match.group(1)
return None
def get_file(self):
view = self.view
if len(view.sel()) == 1:
line = view.line(view.sel()[0])
while line.begin() > 0:
line_text = view.substr(line)
match = re.match(r"(.+):$", line_text)
if match:
if os.path.exists(match.group(1)):
return match.group(1)
line = view.line(line.begin() - 1)
return None
Set up a key binding with the command find_in_files_goto
. Be careful when doing this though. Ideally, there would be some setting that identifies this view as the "Find In Files" view, so you could use that as a context. But I'm not aware of one. Of course, if you do find one, let me know.
Edit Pulling up the example key binding into the main body of the answer.
{
"keys": ["enter"],
"command": "find_in_files_goto",
"context": [{
"key": "selector",
"operator": "equal",
"operand": "text.find-in-files"
}]
}
on SublimeText 3
I had to use F4
(for going to the current result file) and Shift +F4
(for previous result).
From the default keymap...
{ "keys": ["super+shift+f"], "command": "show_panel", "args": {"panel": "find_in_files"} },
{ "keys": ["f4"], "command": "next_result" },
{ "keys": ["shift+f4"], "command": "prev_result" },
I hope this post helps.
SP
the command 'next_result' will do this. using the neat idea muhqu posted about using scope, you can make it so that you can press 'enter' on the line that you want to goto:
,{ "keys": ["enter"], "command": "next_result", "context": [{"key": "selector",
"operator": "equal", "operand": "text.find-in-files" }]}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With