muh*_*hqu 51 find sublimetext sublimetext2 sublimetext3
如果你File> Find in Files... ⇧+ ⌘+ F你被带到了Find Results,列出文件和突出显示的匹配.您可以双击文件名/路径或匹配的行以在右侧打开文件.
我想知道是否有办法完全通过键盘进行双击?
凭借Sublimes出色的文件切换功能,我认为必须有一种方法可以让您在操作时保持键盘Find in Files....
Chr*_*yer 58
尝试Shift+ F4(铝键盘上的fn+ Shift+ F4).
sku*_*oda 28
看来已创建了一个插件来执行此操作.快速浏览一下,插件中还有一些其他功能.虽然我的原始答案可行,但安装现有插件会容易得多.
https://sublime.wbond.net/packages/BetterFindBuffer
可以使用插件.
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
Run Code Online (Sandbox Code Playgroud)
使用该命令设置密钥绑定find_in_files_goto.这样做时要小心.理想情况下,会有一些设置将此视图标识为"在文件中查找"视图,因此您可以将其用作上下文.但我不知道一个.当然,如果你找到了,请告诉我.
编辑 将示例键绑定到答案的主体中.
{
"keys": ["enter"],
"command": "find_in_files_goto",
"context": [{
"key": "selector",
"operator": "equal",
"operand": "text.find-in-files"
}]
}
Run Code Online (Sandbox Code Playgroud)
Som*_*dar 19
在SublimeText 3我不得不使用F4(用于将当前结果文件)和Shift +F4(对于以前的结果).
从默认的keymap ...
{ "keys": ["super+shift+f"], "command": "show_panel", "args": {"panel": "find_in_files"} },
{ "keys": ["f4"], "command": "next_result" },
{ "keys": ["shift+f4"], "command": "prev_result" },
Run Code Online (Sandbox Code Playgroud)
我希望这篇文章有所帮助.
SP
rob*_*son 11
命令'next_result'将执行此操作.使用关于使用范围的简洁想法muhqu,您可以使它在您想要转到的行上按"输入":
,{ "keys": ["enter"], "command": "next_result", "context": [{"key": "selector",
"operator": "equal", "operand": "text.find-in-files" }]}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18495 次 |
| 最近记录: |