簡體   English   中英

如何在 Sublime Text 中添加新的片段

[英]How to add new snippets in Sublime Text

我知道如何在 VS Code 中創建代碼片段,但我同時使用 Sublime Text。 但是,我不知道如何在 Sublime Text 中創建片段到 python 語法,請幫我處理。

創建代碼片段就像 VS Code 一樣簡單。 只需 go 到工具 -> 開發人員 -> 新片段

你可以看到像這樣的 xml 文件:

<snippet>
<content><![CDATA[
Hello, ${1:this} is a ${2:snippet}.
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>hello</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.python</scope>
</snippet>
  1. 編輯參數 of 為主要內容,tabTrigger 為提示。
  2. 您還可以在(python 是默認的)中設置語言
  3. 最后,將其保存在帶有.sublime-snippet擴展名的 Sublime 文件夾中。
  4. 享受 )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM