Typography

活版印字


  • Home
  • Archive
  • Categories
  • Tags
  •  

© 2020 alincode

Theme Typography by Makito

Proudly published with Hexo

建立自己的 ATOM snippet

Posted at 2016-03-19 ATOM 

再 ATOM 上有蠻多 Snippet 的 package 可以安裝,不過有時候更新速度不夠快,你還是想要建立自己的,首先開啟 ATOM 然後工具列的地方,點一下 Open Your Snippet。

它會幫你開啟一個 snippet.cson 的文字檔

Snippet 格式

簡單範例

1
2
3
4
5
6
7
'.source.js':
'print request body':
'prefix': 'tb'
'body': 'console.log("=== res.body ==>", res.body);$1'
'print arrow':
'prefix': 't'
'body': 'console.log("==========> ", $1);'
  • source.js 指的是哪種支援哪種副黨名的檔案
  • prefix 是指快速鍵
  • body 則是你自己指定的自動產生內容
  • $1 則是內容產生後,你指標停留的位址,除了 $1 之外,你也可以取 $2,可用 tab 鍵依序切換。

更多範例

  • language-html.cson
  • language-javascript.cson

參考來源

  • using-atom-snippets
  • Basic Customization

Share 

 Previous post: JWT Authentication with AngularJS 重點整理 (1) Next post: Speed up Server Side Rendering 重點整理 

© 2020 alincode

Theme Typography by Makito

Proudly published with Hexo