zoukankan      html  css  js  c++  java
  • yasnippet.org

    ya-snippet.org

    ya-snippet.org

    Writing snippets

    Template syntax

    Plain Text

    Arbitrary text can be included as the content of a template. They are usually interpreted as plain text, except $ and `. You need to use \ to escape them: \$ and \`. The \ itself may also needed to be escaped as \\ sometimes.

    Embedded Emacs-lisp code

    Emacs-Lisp code can be embedded inside the template, written inside back-quotes (`). The lisp forms are evaluated when the snippet is being expanded. The evaluation is done in the same buffer as the snippet being expanded.

    Here's an example for c-mode to calculate the header file guard dynamically:

    #ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_}
    #define $1
    
    $0
    
    #endif /* $1 */
    

    Tab step fields

    Placeholder fields

    Mirrors

    We refer the tab stops with placeholders as a field. A field can have mirrors. Its mirrors will get updated when you change the text of a field.


    Post by: Jalen Wang (转载请注明出处)

  • 相关阅读:
    JS创建类和对象(好多方法哟!)
    BMI身体质量指数计算公式
    点击button显示文字
    xml中设置button的背景颜色
    Android layout的属性介绍
    eclipse中自动补齐代码设置
    android开发中常用的快捷键
    eclipse修改Android工程图标显示
    Android运行报错
    读《人月神话》有感
  • 原文地址:https://www.cnblogs.com/jalenwang/p/3046053.html
Copyright © 2011-2022 走看看