插件: view-in-browser

CTRL + ALT + V 打开浏览器

默认打开firefox,settings里面可修改。

Sublime Text - View In Browser

View In Browser is a Sublime Text plugin that will open whatever is in your current view/tab. If the file current open is new and has not been saved a temporary file is created (in your default temp directory for your OS) with the extension of .htm and your browser will open it. However if the current open file is saved and has a name this plugin will open it in whatever you have set to handle its type.

By default the keystroke assigned to this plugin is CTRL + ALT + V.

Installation

Using the Sublime Text Package Control plugin (http://wbond.net/sublime_packages/package_control) press CTRL + SHIFT + P and find Package Control: Install Package and press Enter. Find this plugin in the list by name View In Browser.

Configuring Browsers

By default this plugin will open files in Firefox. You can configure it to open using another browser of your choice. To do this, choose Settings - User from Preferences > Package Settings > View In Browser.

The browser you wish to use to open files is set in the key named browser. The following is a list of browsers configured for use out of the box.

  • Firefox - Mac OS, Linux, Windows
  • Chrome - Mac OS, Linux, Windows
  • Chrome64 - Windows
  • Yandex - Windows
  • Safari - Mac OS
  • Internet Explorer - Windows
  • Chromium - Linux

Other Browsers

View In Browser also provides key bindings to open your current view in browser other than your browser setting. Below is a listing of the keys and what browser open with those key bindings.

  • CTRL + ALT + F - Firefox
  • CTRL + ALT + C - Chrome
  • CTRL + ALT + I - Internet Explorer
  • CTRL + ALT + S - Safari

Like any other key binding in Sublime these can be changed. Below is an example of the key configuration. You can remap these in your User key bindings configuration file.

[
{ "keys": [ "ctrl+alt+v" ], "command": "view_in_browser" },
{ "keys": [ "ctrl+alt+f" ], "command": "view_in_browser", "args": { "browser": "firefox" } },
{ "keys": [ "ctrl+alt+c" ], "command": "view_in_browser", "args": { "browser": "chrome" } },
{ "keys": [ "ctrl+alt+i" ], "command": "view_in_browser", "args": { "browser": "iexplore" } },
{ "keys": [ "ctrl+alt+s" ], "command": "view_in_browser", "args": { "browser": "safari" } }
]

Windows Considerations

One of the things you may notice in the Windows configuration for chrome is a variable in the command path that looks like: %Local AppData%. This is a reference to your Windows installation's AppData folder in your user profile directory. There is a variable there because this value will differ for each user on your computer, and Chrome installs to your AppData folder.

Here is a list of supported variables:

  • AppData - Your main application data folder for your profile (usually roaming)
  • Personal - Your documents location
  • Desktop - The path to your Desktop location (may be unreliable)
  • Start Menu - The path to your Start Menu items location
  • Local AppData - Your local application data folder for your profile
  • My Video - Path to your videos location
  • My Pictures - Path to your pictures location
  • My Music - Path to your music location

Note that many of these are not terribly useful for determining browser location, unless you have decided to install Firefox in your My Music folder.

Configure to View on Local Server

The View In Browser plugin also supports the ability to view files in the context of a local server. So if you have a local Apache, Tomcat, or some other server application running you can configure this plugin to open your file prefixed with a URL.

To configure this the View In Browser plugin reads the configuration of your currently loaded project. You can edit a project file by opening the sublime-project file by choosing Project -> Edit Project. In your project file you will need to specify two things:

  • baseUrl - The root URL to prefix files with
  • basePath - The base path where your site/application lives

Here's how that looks.

{
"folders":
[
{
"path": "/home/<username>/code/python/my-cool-website"
}
],
"settings": {
"sublime-view-in-browser": {
"baseUrl": "http://localhost:8080",
"basePath": "/home/<username>/code/python/my-cool-website"
}
}
}

Notice the key named settings which is a dictionary that contains another key named sublime-view-in-browser. This is where you will put your baseUrl and basePath settings.

Now when you activate View In Browser your file will open with the HTTP protocol instead of the FILE protocol.

sublime text3如何在浏览器预览?的更多相关文章

  1. Sublime Text 3 配置浏览器预览路径 localhost

    原文链接:http://jingyan.baidu.com/article/15622f2419ce79fdfcbea5ea.html 按步骤设置成功!感谢大侠! 以下是原文: Sublime Tex ...

  2. sublime txt 设置在浏览器预览

    1. 安装SideBarEnhancements插件 ctrl+shift+p —> Install Package —> 找到SideBarEnhancements 2. 配置预览快捷键 ...

  3. 在sublime text 3中设置浏览器预览快捷键

    1.安装 SideBarEnhancements ctrl+shift+p,进入命令模式,然后输入package control(或者直接输 pci 或许也行),回车: 输入:SideBarEnhan ...

  4. 设置sublime text2/3中默认预览浏览器快捷键的方法

    各位前端大神们,大家在用IDE编辑器的时候喜欢用哪些呢?是Dreamweaver.Zend Studio.editplus又或者是sublime text?今天马浩周给大家就要说说设置sublime ...

  5. sublime3下载安装及常用插件、浏览器预览设置

    之前与学习前端有关的软件都安装在了实验室电脑上,最近由于要放寒假(也许我寒假回去会学习呢),于是得在笔记本电脑上重新安装一遍.几个软件各种出错,花了一下午才安装好,必须记录下来啊! 这篇文章主要介绍s ...

  6. Window 7 平台的IE11浏览器预览版发布

    继之前Windows 8.1 带来了IE11浏览器之后,今天Window 7 以及Windows Server 2008 R2平台的IE11浏览器预览版也已经发布. 当然这还只是一个开发者预览版,可能 ...

  7. vscode如何用浏览器预览运行html文件

    1,打开vscode编辑器,点击编辑器主界面左上侧第五个小图标——‘扩展’按钮: 2,进入扩展搜索右拉框,在应用商店搜索框中输入“view in browser”会自动进行搜索 3,等待几秒钟时间,扩 ...

  8. Sublime Text3 实现在浏览器中以HTML格式预览md文件

    1.首先找到Package Control 打开Sublime Text3,找到菜单栏:Preferences → Package Control,没有找到Package Control,那么点击Pa ...

  9. sublime实现markdown浏览器预览

    效果预览 实现 首先下载插件OmniMarkupPreviewer 方法:ctrl + shift + P 安装完成后搜索'OmniMarkupPreviewer'双击即可 下载完成后新建.md文件 ...

随机推荐

  1. saver.restore()遇到的错误

    运行python程序执行  saver.restore(sess,"E:/pythonFile/untitled/deepLearning/model/model.ckpt")   ...

  2. linux下压力测试工具ab的使用

    一.安装 [root@node2 logs]# yum install httpd-tools 已加载插件:fastestmirror Loading mirror speeds from cache ...

  3. Maven模块化开发

    Maven模块化开发 多人协同开发时,特别是规模较大的项目,为方便日后代码维护管理会将每个人的工作细分到具体的功能和模块上.随着项目的不断扩大,模块会越来越多,后续更加难以维护和扩展,为应对这种情况后 ...

  4. Linux 使用nmcli配置网络

    Linux 使用nmcli配置网络 前提: 在虚拟机中添加一张桥接模式的网卡,如果是VirtualBox虚拟机中要shutdown才能添加. 1.启动NetworkManager工具,安装nmcli命 ...

  5. 关于socket

    使用socket常用的操作就是读写,recv和send,与read.write对应,但多了一个flag位可以设定阻塞等,一些细节以后再探.目前使用时发现read往往不能将数据完整读出,可能是调用时内核 ...

  6. paloalto防火墙版本升级

    1.准备工作:此部分不影响生产环境,可直接操作. 1)备份: 2)下载OS HA情况下,在主机下载完成后,选择 Sync To Peer(同步到对端)同步到备机. 2.安装更新 1)在备机上选择安装 ...

  7. Mapnik 3.0.20编译安装

    1. 确定epel安装 yum install -y epel-release 2. 按照<CentOS7.2部署node-mapnik>一文中的步骤,手动安装 gcc-6.2.0 和 b ...

  8. 获取txt md5值上传文件完整性校验

    网络上传文件到服务器 做md5 校对.判断文件是否破坏 首先求txt文件的md5值 ,1万条数据 求出的值 文件MD5:e5467b6a8e3c26af8c5af0bda3739280 服务器处理程序 ...

  9. linux下编译protobuf(可以编译成pb.go)

    编译前需要安装gtest $ cd googletest $ cmake -DBUILD_SHARED_LIBS=ON . $ make $ sudo cp -a include/gtest /hom ...

  10. python学习——用dictionary实现通过地区查询邮编

    刚刚学习了python的基本语法,对自己学习的内容进行实践下. dictionary字典(类似map) 总结:1.dictionary比list读取速度快,但是占用内存大,适合存放不需修改,经常查询的 ...