在指定浏览器(例如 Chrome)中打开文件的 Sublime Text 2 键盘快捷键 [英] Sublime Text 2 keyboard shortcut to open file in specified browser (e.g. Chrome)

查看:37
本文介绍了在指定浏览器(例如 Chrome)中打开文件的 Sublime Text 2 键盘快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从事网络开发并正在试用 Sublime Text 2.是否有键盘快捷键可以在指定的浏览器(例如 Chrome)中打开当前文件?

I do web development and am trying out Sublime Text 2. Is there a keyboard shortcut to open the current file in specified browser (e.g. Chrome)?

感谢任何在 Sublime Text 中设置 Web 开发的帮助!

Any help to get setup in Sublime Text for web development is appreciated!

推荐答案

我不确定这个问题在这里是否合适,但是您可以在 Tools -> 下添加一个新的构建系统".构建系统 ->新建构建系统...

I'm not really sure this question is approprate here, but you can add a new "Build System" under Tools -> Build System -> New Build System...

与 Sublime Text 中的所有配置一样,它只是 JSON,所以它应该非常简单.您要配置的主要内容是 "cmd" 键/值.这是在我的 Mac 上启动 chrome 的构建配置.

As with all configuration in Sublime Text its just JSON, so it should be pretty straight forward. The main thing you are going to want to configure is the "cmd" key/val. Here is the build config for launching chrome on my mac.

{
    "cmd": ["open", "-a", "Google Chrome", "$file"]
}

将其另存为 Chrome.sublime-build,重新启动 Sublime Text,您应该会在构建列表中看到一个新的 Chrome 选项.选择它,然后您应该可以在 Mac 上使用 Cmd+B 启动 Chrome(或者您为构建配置的任何热键,可能是 F7Ctrl+B 在 Windows 机器上)

Save that as Chrome.sublime-build, relaunch Sublime Text and you should see a new Chrome option in the build list. Select it, and then you should be able to launch Chrome with Cmd+B on a Mac (or whatever hotkey you have configured for build, maybe its F7 or Ctrl+B on a Windows machine)

至少这应该会让你朝着正确的方向前进.

At least this should give you a push in the right direction.

我最终在 Sublime Text 2 中做的另一件事是,如果您在文档内右键单击,上下文菜单中的一项是 Copy File Path,它将当前文件的完整路径到剪贴板,以便轻松粘贴到您想要的任何浏览器中.

Another thing I end up doing a lot in Sublime Text 2 is if you right click inside a document, one of the items in the context menu is Copy File Path, which puts the current file's full path into the clipboard for easy pasting into whatever browser you want.

崇高的文字 3(Linux示例)"shell_cmd": "google-chrome '$file'"

Sublime Text 3 (linux example) "shell_cmd": "google-chrome '$file'"

这篇关于在指定浏览器(例如 Chrome)中打开文件的 Sublime Text 2 键盘快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆