1. 安装emmet: Preferences -> Package Control -> Install Package -> emmet

2. 配置emmet: Preferences -> Package Settings -> Emmet -> Key Bindings - User

 将下方的代码贴到打开的文件中,然后就可以使用tab键对render中的(部分)html元素使用自动补全功能了

 [
{
"keys": [
"super+e"
],
"args": {
"action": "expand_abbreviation"
},
"command": "run_emmet_action",
"context": [
{
"key": "emmet_action_enabled.expand_abbreviation"
}
]
},
{
"keys": [
"tab"
],
"command": "expand_abbreviation_by_tab",
"context": [
{
"operand": "source.js",
"operator": "equal",
"match_all": true,
"key": "selector"
},
{
"key": "preceding_text",
"operator": "regex_contains",
"operand": "(\\b(a\\b|div|span|p\\b|button)(\\.\\w*|>\\w*)?([^}]*?}$)?)",
"match_all": true
},
{
"key": "selection_empty",
"operator": "equal",
"operand": true,
"match_all": true
}
]
}
]

补充:

  在贴了上述代码之后,只有部分标签用tab键能够自动补全,但是还有很多标签只能用ctrl+e补全,比如h1,Route等,经查阅,将上述代码替换为下面的代码,则能解决这个问题

 [{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab", // put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [{
"operand": "source.js",
"operator": "equal",
"match_all": true,
"key": "selector"
}, // run only if there's no selected text
{
"match_all": true,
"key": "selection_empty"
}, // don't work if there are active tabstops
{
"operator": "equal",
"operand": false,
"match_all": true,
"key": "has_next_field"
}, // don't work if completion popup is visible and you
// want to insert completion with Tab. If you want to
// expand Emmet with Tab even if popup is visible --
// remove this section
{
"operand": false,
"operator": "equal",
"match_all": true,
"key": "auto_complete_visible"
}, {
"match_all": true,
"key": "is_abbreviation"
}
]
}]

sublime text 3 ,React,html元素自动补全方法(用Emmet写法写jsx中的html)的更多相关文章

  1. Sublime Text 3 import Anaconda 无法正常补全模块名解决办法

    Sublime Text 3 Anaconda配置 在安装Sublime Text3之后我们总会安装一些插件,比如Python的Anaconda自动补全插件.但是,装好之后发现import 时无法像别 ...

  2. sublime工具 插件自动补全方法

    自动补全(emmet),输入对应的关键字(html标签)---tab键 http://www.emmet.io/ 代码片段 只需要输入自己的关键字--tab键 操作: 添加代码片段,然后保存 保存 使 ...

  3. Mysql命令行tab自动补全方法

    在mysql命令行有时为了方便想要按tbl键自动补全命令,以便节约时间. 具体方法如下: 第一步:修改my.cnf vi mysql/etc/my.cnf 将下图红框的代码注释,修改成如下代码: #d ...

  4. Sublime Text3 python自动补全问题——Sublime Text3安装Anaconda插件

    学习python的时候 在编辑器的选择上会有很多选择,我最终还是选择了sublime text3. 相对于其他编辑器,sublime text有以下特性: 插件多,类似GoSublime,Emmet信 ...

  5. vim自动补全

    Vim 中使用 OmniComplete 为 C/C++ 自动补全 OmniComplete 并不是插件的名字,而是 Vim 众多补全方式中的一种(全能补全).说白了 OmniComplete 其实就 ...

  6. Sublime2 DocBlocker插件在自动补全注释时输出自定义作者和当前时间等信息

    Sublime在进行前端开发时非常棒,当然也少不了众多的插件支持,DocBlocker是在Sublime平台上开发一款自动补全代码插件,支持JavaScript (including ES6), PH ...

  7. TCL函数“参数自动补全” 与 “help 信息显示”

    tcl 函数参数自动补全和 help 信息显示 在EDA tool 中使用命令时,命令的参数可以通过 tab 键自动补全,而且可以使用 -help 显示帮助信息,使用起来很方便: 那么我们自己编写的 ...

  8. 知问前端——自动补全UI

    自动补全(autocomplete),是一个可以减少用户输入完整信息的UI工具.一般在输入邮箱.搜索关键字等,然后提取出相应完整字符串供用户选择. 调用autocomplete()方法 var hos ...

  9. 第一百八十一节,jQuery-UI,知问前端--自动补全 UI--邮箱自动补全

    jQuery-UI,知问前端--自动补全 UI--邮箱自动补全 学习要点: 1.调用 autocomplete()方法 2.修改 autocomplete()样式 3.autocomplete()方法 ...

随机推荐

  1. linux php7.2安装扩展memcached

    wget http://pecl.php.net/get/igbinary-2.0.8.tgz tar -xzvf igbinary-2.0.8.tgz cd igbinary-2.0.8 /usr/ ...

  2. shell+Zabbix export应用之AD环境删除离职人员登录主机之资料

    以实际环境:维护环境172.30网段主机 Zabbix hosts export出主机信息至 /tmp/ip.txt shell筛选出ip [root@server ~]# cat /tmp/ip.t ...

  3. ThinkPHP部署在lnmp环境中碰到的问题

    先说一下问题: 因为tp5的入口文件在public目录下,而Application和public同级, 我用的lnmp1.5默认做了防跨站目录设置,所以导致入口文件无法进入application目录, ...

  4. 【tomcat环境搭建】一台服务器上部署多个tomcat

    一台服务器上面如何部署多个tomcat?其实linux和windows步骤都差不多,都是: 第一步:解压tomcat安装包后,复制一份并且重命名:多个tomcat就多复制一份 第二步:将复制的tomc ...

  5. java中引用的概念

    强引用(StrongReference) 强引用就是指在程序代码之中普遍存在的,比如下面这段代码中的object和str都是强引用: 1 2 Object object = new Object(); ...

  6. C++11 相关教程

    C++11 中文wiki: https://zh.wikipedia.org/zh-cn/C%2B%2B11 C++11 新特性介绍: https://www.kancloud.cn/wangshub ...

  7. webpack 大概

    entry output loader: rules: [ {test:匹配文件格式,  use: 使用的loader}, {test:匹配文件格式,  use: 使用的loader}, ...//l ...

  8. xpath简单实用

    一.xpath 基本语法 /html /html/head/title 绝对路径(一层层的查找) /html//title 相对于当前节点 //title/./../.. . 当前节点 ..父节点 . ...

  9. python orm框架

    #!/usr/bin/python# -*- coding: utf-8 -*-from sqlalchemy import create_enginefrom sqlalchemy import T ...

  10. paramiko__摘抄

    # -*- coding:utf-8 -*-# Author: Dennis Huang__Author__ = "Dennis" import paramiko # ssh = ...