{"id":2517,"date":"2015-11-07T16:16:53","date_gmt":"2015-11-07T08:16:53","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=2517"},"modified":"2015-11-07T16:16:53","modified_gmt":"2015-11-07T08:16:53","slug":"%e5%9c%a8sublimet-text2%e4%b8%ad%e5%88%9b%e5%bb%basnippet%e7%89%87%e6%ae%b5","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/2517.html","title":{"rendered":"\u5728Sublimet Text2\u4e2d\u521b\u5efasnippet\u7247\u6bb5"},"content":{"rendered":"<p>=Start=<\/p>\n<h5>\u4e3aGolang\u683c\u5f0f\u7684\u4ee3\u7801\u521b\u5efasnippet\u7247\u6bb5<\/h5>\n<pre class=\"lang:default decode:true \">$ cd $HOME\/Library\/Application\\ Support\/Sublime\\ Text\\ 2\/Packages\/\n$ find . -type f -iname \"*.tmSnippet\"\n$ cp .\/Go\/func.tmSnippet .\/User\/go_comment.tmSnippet\n\n$ vim .\/User\/go_comment.tmSnippet\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n&lt;!DOCTYPE plist PUBLIC \"-\/\/Apple\/\/DTD PLIST 1.0\/\/EN\" \"http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd\"&gt;\n&lt;plist version=\"1.0\"&gt;\n&lt;dict&gt;\n\t&lt;key&gt;content&lt;\/key&gt;\n\t&lt;string&gt;\/*\n$0\n*\/&lt;\/string&gt;\n\t&lt;key&gt;name&lt;\/key&gt;\n\t&lt;string&gt;Multi-line comment&lt;\/string&gt;\n\t&lt;key&gt;scope&lt;\/key&gt;\n\t&lt;string&gt;source.go&lt;\/string&gt;\n\t&lt;key&gt;tabTrigger&lt;\/key&gt;\n\t&lt;string&gt;comment&lt;\/string&gt;\n\t&lt;key&gt;uuid&lt;\/key&gt;\n\t&lt;string&gt;E9B44CC5-B004-4793-B125-7E429FDCCE99&lt;\/string&gt;\n&lt;\/dict&gt;\n&lt;\/plist&gt;<\/pre>\n<p>\u4e0a\u9762\u7684\u5185\u5bb9\u4e2d\u6709\u51e0\u4e2a\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n<pre class=\"lang:default decode:true\">1.\u4f5c\u7528\u8303\u56f4\u8bbe\u5b9a\u4e3aGolang\u4ee3\u7801\n&lt;string&gt;source.go&lt;\/string&gt;\n\n2.uuid\u7684\u503c\u9700\u8981\u552f\u4e00\n&lt;key&gt;uuid&lt;\/key&gt;\n&lt;string&gt;E9B44CC5-B004-4793-B125-7E429FDCCE99&lt;\/string&gt;\n\n3.\u540e\u7f00\u540d\n\u9700\u8981\u4e3a\".tmSnippet\"\n\n4.\u4fdd\u5b58\u8def\u5f84\n\u4fdd\u5b58\u8def\u5f84\u4e3a\"$HOME\/Library\/Application\\ Support\/Sublime\\ Text\\ 2\/Packages\/User\/\"<\/pre>\n<h6>\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/13922174\/defining-scope-for-custom-sublime-text-2-snippets\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/13922174\/defining-scope-for-custom-sublime-text-2-snippets<\/a><\/li>\n<li><a href=\"http:\/\/sublimetext.info\/docs\/en\/extensibility\/snippets.html\" target=\"_blank\">http:\/\/sublimetext.info\/docs\/en\/extensibility\/snippets.html<\/a><\/li>\n<li><a href=\"http:\/\/segmentfault.com\/a\/1190000000488650\" target=\"_blank\">http:\/\/segmentfault.com\/a\/1190000000488650<\/a><\/li>\n<li><a href=\"https:\/\/gist.github.com\/iambibhas\/4705378\" target=\"_blank\">https:\/\/gist.github.com\/iambibhas\/4705378<\/a><\/li>\n<\/ul>\n<h5>\u4e3aBash\u683c\u5f0f\u7684\u4ee3\u7801\u521b\u5efasnippet\u7247\u6bb5<\/h5>\n<p>\u5728\u83dc\u5355\u4e0a\u70b9\u51fb&#8221;Tools -&gt; New Snippet&#8221;\uff0c\u4f1a\u65b0\u5efa\u4e00\u4e2aXML\u683c\u5f0f\u7684\u6587\u4ef6\uff0c\u521d\u59cb\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:default decode:true \">&lt;snippet&gt;\n\t&lt;content&gt;&lt;![CDATA[\nHello, ${1:this} is a ${2:snippet}.\n]]&gt;&lt;\/content&gt;\n\t&lt;!-- Optional: Set a tabTrigger to define how to trigger the snippet --&gt;\n\t&lt;!-- &lt;tabTrigger&gt;hello&lt;\/tabTrigger&gt; --&gt;\n\t&lt;!-- Optional: Set a scope to limit where the snippet will trigger --&gt;\n\t&lt;!-- &lt;scope&gt;source.python&lt;\/scope&gt; --&gt;\n&lt;\/snippet&gt;<\/pre>\n<p>\u4fee\u6539\u4e3a\uff1a<\/p>\n<pre class=\"lang:default decode:true \">&lt;snippet&gt;\n    &lt;content&gt;&lt;![CDATA[#!\/bin\/bash\n# Author:\tixyzero.com\n# Date:\t\t${1:datetime}\n# set -x\nexport PATH=\/usr\/local\/bin:\/bin:\/usr\/bin:\/sbin:\/usr\/sbin\/:\/usr\/local\/sbin\n\nVERBOSE=\"N\"\n\nfunction func_name() {\n    # to do\n    :\n}\n\nfunction func_main() {\n    func_name\n}\nfunc_main\n]]&gt;&lt;\/content&gt;\n    &lt;!-- Optional: Set a tabTrigger to define how to trigger the snippet --&gt;\n    &lt;tabTrigger&gt;ibash&lt;\/tabTrigger&gt;\n    &lt;!-- Optional: Set a scope to limit where the snippet will trigger --&gt;\n    &lt;scope&gt;source.shell&lt;\/scope&gt;\n&lt;\/snippet&gt;<\/pre>\n<p>\u6ce8\uff1a\u672c\u6765\u60f3\u63d2\u5165\u7684snippet\u662f\u529f\u80fd\u66f4\u5168\u7684\u4e00\u4e2a\u6a21\u677f\uff0c\u4f46\u662f\uff0c\u56e0\u4e3a$1\u3001$0\u8fd9\u4e9b\u548cBash\u7684\u547d\u4ee4\u884c\u53c2\u6570\u51b2\u7a81\uff0c\u5e76\u4e14\uff0c${BASH_SOURCE}\u3001${LINENO}\u3001${FUNCNAME[0]}\u3001\u2026\u2026\u7b49\u51b2\u7a81\uff0c\u6240\u4ee5\u53ea\u80fd\u7f29\u51cf\u4e3a\u4e0a\u9762\u90a3\u6837\u624d\u884c\u3002<\/p>\n<p>=EOF=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u4e3aGolang\u683c\u5f0f\u7684\u4ee3\u7801\u521b\u5efasnippet\u7247\u6bb5 $ cd $HOME\/Library\/Appl [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,7,12],"tags":[561,562],"class_list":["post-2517","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-programing","category-tools","tag-snippet","tag-sublimetext2"],"views":2892,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=2517"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2517\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=2517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=2517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=2517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}