插件: 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. Excel VBA 连接各种数据库(一) VBA连接MySQL数据库

    本文参考[东围居士]的cnblog博文  Excel.VBA与MySQL交互  在自己机器上调试成功,把调试中遇到的问题一并写出了. 本文主要涉及: VBA中的MySQL环境配置 VBA连接MySQL ...

  2. java PDF添加图层,支持多页图层添加

     java PDF添加图层,支持多页图层添加 代码: import java.io.File; import java.io.FileOutputStream; import java.io.IOEx ...

  3. linux学习笔记:linux常用的命令

    2018-11-19                                      常见命令快速查询一览表 命令 功能 ls 列出目录内容 cat 链接文件并打印到标准输出设备上(通常用来 ...

  4. vim常用配置 vimrc文件

    自从接触vim,自己瞎鼓捣.vimrc也有一段时间了.收集记录一下好用的配置. 一.奇技淫巧 1.折叠代码 折叠代码常常用在代码块较长的情况下,比如一个文件里定义了很多个函数,或者注释.括号影响的阅读 ...

  5. 在进行商业运算时解决BigDecimal的精度丢失问题

    System.out.println(0.05+0.01); System.out.println(1.0-0.42); System.out.println(4.015*100); System.o ...

  6. c# int类型的转datetime类型

    int a =20190319; DateTime  b =  DateTime.ParseExact(a.tostring(),"yyyyMMdd",System.Globali ...

  7. 记录-springcloud -mybatis

    搭建springcloud与mybatis 从数据库读取数据返回到浏览器 1:我的工程目录 entity  和mapper 中的代码 controller和service的代码 启动类的文件:记得加包 ...

  8. 关于fftshift----将零频率的分量移到频谱的中心

    fftshift 作用:将零频点移到频谱的中间 用法: Y=fftshift(X) Y=fftshift(X,dim) 描述:fftshift移动零频点到频谱中间,重新排列fft,fft2和fftn的 ...

  9. Python基础 ----- 流程控制

    ------   条件判断 if 条件判判断语法: 条件判断注意: 1.由if 条件起始 2.关键字后面要加一个空格 3.条件后面接: 4.符合python代码缩进格式 5.条件判断可以有多种组合方式 ...

  10. 《AlwaysRun!团队》第二次作业:团队项目选题报告

    第二次作业:团队项目选题报告 项目  内容  这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/  这个作业的要求在哪里 https://www.cnblog ...