search
HomeDevelopment ToolssublimeHow to write sublime Snippet
How to write sublime SnippetJul 05, 2021 pm 04:21 PM
sublime-text

下面由sublime教程栏目给大家介绍sublime Snippet如何编写!

How to write sublime Snippet

sublime Snippet编写

    <snippet>
        <content></content>
        <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
        <!-- <tabTrigger>hello</tabTrigger> -->
        <tabtrigger>hello</tabtrigger>
        <!-- Optional: Set a scope to limit where the snippet will trigger -->
        <!-- <scope>source.python</scope> -->
        <scope>text.html</scope>
        <description>Hellossssssssssssssssssssssssssssssssssssssss My test.</description>
    </snippet>

snippet是片段的意思,就是说智能提示的概念。

content是片段内容,scope标签是触发的文件类型,tagTrigger是触发的关键字,description是注释说明

他和macro的区别是:
宏的操作都是需要用快捷键的,而且保存的宏必须加载在系统keymap文件user自定义部分当中。
eg:

对已经保存的宏的操作:

[      { "keys": ["ctrl+shift+;"], "command": "run_macro_file", "args": {"file": "res://Packages/User/test.sublime-macro"} }  ]
 而snippet操作是用于只能提示,只要文件保存了系统就会自动加载,不需要keymap。

但是,marco是对多个操作的统一规划,而snippet只是只能提示罢了。
也就是说当你需要一堆有顺序的按键操作的时候,使用marco,记录宏实际上就是记录你的按键顺序。
而当你想加载一个模板或者智能提示时,用snippet

效果如图所示

How to write sublime Snippet

The above is the detailed content of How to write sublime Snippet. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:segmentfault. If there is any infringement, please contact admin@php.cn delete
How to run the code in sublime?How to run the code in sublime?Mar 06, 2025 am 11:36 AM

This article explains how to execute code in Sublime Text using external tools and build systems. It details creating language-specific build systems (e.g., Python, C , JavaScript) via JSON files, and running code via Ctrl B. While Sublime Text

Is sublime free?Is sublime free?Mar 06, 2025 am 11:29 AM

Sublime Text is a freemium code editor offering full functionality for free, albeit with occasional license prompts. The article discusses its licensing model, feature limitations (primarily the prompts), and paid-version benefits (primarily removin

How to compile and run java code in sublimeHow to compile and run java code in sublimeMar 06, 2025 am 11:35 AM

This article guides Java developers on configuring Sublime Text for compiling and running Java code. It details setting up a custom build system (JavaC.sublime-build) to handle compilation and execution, emphasizing JDK installation and PATH environ

How to run sublime code C languageHow to run sublime code C languageMar 06, 2025 am 11:33 AM

This article explains how to run C code in Sublime Text. It emphasizes that Sublime Text needs an external compiler (like GCC) and a build system (a .sublime-build file) to compile and execute C code. The process involves installing a compiler, defi

Sublime Set encoding formatSublime Set encoding formatMar 06, 2025 am 11:25 AM

This article explains Sublime Text's per-file encoding handling, lacking a global default. It emphasizes UTF-8 as the best practice for consistency and broad compatibility, advising users to explicitly save files with the chosen encoding and levera

What is sublime for? What is sublime software?What is sublime for? What is sublime software?Mar 06, 2025 am 11:30 AM

Sublime Text is a fast, customizable cross-platform text editor popular with developers. Its key features include multiple selections, Goto Anything, a command palette, and extensive plugin support. While free to use, a license removes nag screens a

Sublime test installation tutorialSublime test installation tutorialMar 06, 2025 am 11:37 AM

This tutorial guides Sublime Text installation on Windows, package management (using Package Control or manual methods), and interface customization (themes, keybindings, settings, plugins). It addresses the common issue of setting up and personali

sublime column modesublime column modeMar 06, 2025 am 11:24 AM

This article explains Sublime Text's powerful built-in column selection feature. It details activation methods (Alt/Option key mouse drag), selection manipulation using the mouse and keyboard shortcuts, and clarifies that dedicated plugins aren't

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!