DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

User Defined Snippets in VS Code


更新 FPP 时经常要插入Python代码块,反复手工写很麻烦, 用VSC 的自定义代码块功能能比较好的解决重复输入问题, 参考 Creating your own snippets。

首先在 User Settings 中添加 "editor.tabCompletion": true, 然后在 markdown.json (在 command palette 里输入 User Snippets,选择 markdown 打开此文件)里加入:

"Python code block": {
        "prefix": "pyb",
        "body":[
                "```py",
                "$1",
                "```"
        ],
        "description": "add a python code block"
}

保存文件后就自动生效了,在 markdown 文件里输入 pyb, 按两次 Tab 键就会扩展为 Python 代码块。



Published

Oct 5, 2018

Last Updated

Oct 5, 2018

Category

Tech

Tags

  • code snippet 1
  • vsc 2

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor