sublime text 3 添加 javascript 代码片段 ( snippet )
例如:新建console.log();的快捷键为 co
环境:windows 7
step1:
Tools -> New Snippet
<snippet>
<content><![CDATA[consloe.log(${1:this});]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>co</tabTrigger>
<!-- html file -->
<!-- <scope>text.html</scope> -->
<!-- css file -->
<!-- <scope>source.css, source.less, source.scss, source.stylus</scope> -->
<!-- js file -->
<scope>source.js</scope>
<description>console.log</description>
</snippet>
- 第二行里的 ${1:this} 代表光标1所在位置,多个值:比如css的padding:${1:this} ${2:this} ${3:this} ${4:this};
- tabTrigger:触发词
- scope:文件格式,多个用半角逗号隔开
- description:显示在提示右边的描述
step2:
保存文件为 C:\Users\yourname\AppData\Roaming\Sublime Text 3\Packages\User\test.sublime-snippet
这个文件夹即package所在文件夹,Preferences -> Browse Packages 然后下面的user文件夹,一定要存为 .sublime-snippet 后缀
step3:测试
打开或新建一个js文件,输入"co",然后按tab键,即可快捷输入 console.log();
注意:html和css、js的snippet 在<scope></scope>中的写法不一样,html是<scope>text.html</scope>,而js、css是<scope>source.js</scope>和<scope>source.css</scope>
sublime text 3 添加 javascript 代码片段 ( snippet )的更多相关文章
- sublime text 内调试Javascript代码
转自:sublime内调试Javascript代码 之前用webstorm, 可以直接调试js, 在浏览器中也可以调试js,最近换了sublime text, 在想它是否支持调试js代码,于是找到了这 ...
- 在sublime text中添加JavaScript的build-system
-step 1: 下载安装node.js, 并添加到path变量中. -step 2: 在sublime text中新建一个build-system. tools --> build-syste ...
- sublime text 3 添加代码片段
工具>插件开发>新建代码片段 <snippet> <content> <![CDATA[ Hello, ${1:this} is a ${2:snippet} ...
- Sublime Text3—Code Snippets(自定义代码片段)
摘要 程序员总是会不断的重复写一些简单的代码片段,为了提高编码效率,我们可以把经常用到的代码保存起来再调用. 平时用sublime安装各种插件,使用Tab键快速补全,便是snippets(可译为代码片 ...
- VSCode添加用户代码片段,自定义用户代码片段
在使用VScode开发中经常会有一些重复使用的代码块,复制粘贴也很麻烦,这时可以在VScode中添加用户代码片段,输入简写即可快捷输入. VScode中添加用户自定义代码片段很简单. 1.在VScod ...
- 在Sublime Text 3上安装代码格式化插件CodeFormatter
1.了解CodeFormatter插件 在Sublime Text 3中编写代码,为了能让我们的代码格式变得漂亮整洁,需要一个能自动格式代码的插件.这里发现CodeFormatter插件不错,它能支持 ...
- 精心收集的 48 个 JavaScript 代码片段,仅需 30 秒就可理解!
原文:https://github.com/Chalarangelo/30-seconds-of-code#anagrams-of-string-with-duplicates 作者:Chalaran ...
- 精心收集的 48 个 JavaScript 代码片段,仅需 30 秒就可理解
原文:Chalarangelo 译文:IT168 https://github.com/Chalarangelo/30-seconds-of-code#anagrams-of-string-with ...
- 精心收集的48个JavaScript代码片段,仅需30秒就可理解
源文链接 :https://github.com/Chalarangelo/30-seconds-of-code#anagrams-of-string-with-duplicates 该项目来自于 G ...
随机推荐
- 调用微信接口token的问题
前言 微信的影响力众所周知,越来越多的人也都离不开它,工作,生活,社交的好帮手.相信大家对微信公众号,小程序也都不陌生,那么在开发公众号,小程序的时候需要调用到微信的接口,固然就会遇到token的问题 ...
- Contiki 源码风格
/** * \defgroup coding-style Coding style * * This is how a Doxygen module is documented - start wit ...
- html5--1.7超链接上
html5--1.7超链接上 一.超链接的5种形式 <!DOCTYPE html> <html lang="en"> <head> <me ...
- ES BM25 TF-IDF相似度算法设置——
Pluggable Similarity Algorithms Before we move on from relevance and scoring, we will finish this ch ...
- Ubuntu下安装deb包命令
原文地址:http://www.xitongzhijia.net/xtjc/20150206/37464.html 1.下载需要安装的deb包,输入以下命令安装: sudo dpkg -i packa ...
- 高性能MySQL之【第十六章MySQL用户工具】学习记录
接口工具: Msql Workbench http://www.mysql.com/products/workbench SQLyog http://www.webyog.c ...
- 事务之六:spring 嵌套事务
一.基本概念 事务的隔离级别,事务传播行为见<事务之二:spring事务(事务管理方式,事务5隔离级别,7个事务传播行为,spring事务回滚条件) > 二. 嵌套事务示例 2.1.Pro ...
- Python 模拟post请求
# coding:utf-8import requestsurl = "https://passport.cnblogs.com/user/signin" # 接口地址 # 消息头 ...
- 浏览器原生 form 表单POST 数据的两种方式
我们在提交表单的时候,form表单参数中会有一个enctype的参数.enctype指定了HTTP请求的Content-Type. 常用有两种:application/x-www-form-urlen ...
- QTableWidget笔记
1.QTableWidget继承自QTableView. 2.头文件:QTableWidget 3.简单使用: #include "mainwindow.h" #include & ...