vim-snipmate的c.snippets(2016.7.10)

## Main
# main
snippet  main
    int main ( void )
    {
        ${0}
        return 0;
    }

##include
snippet    inc
    #include <${1:stdio}.h>
# conver
snippet    .
    [${1}]
# define
snippet    def
    #define

## Control Statements
# if
snippet    if
    if( ${1:true} ){
        ${0}
    }
# ife
snippet    ife
    if( ${1:true} ){
        ${2}
    }else{
        ${0}
    }
#el
snippet    el
    else{
        ${0}
    }
#else if
snippet    elif
    else if ( ${1:true} ) {
        ${0}
    }
# ifi
snippet    ifi
    if ( ${1:ture} ) ${0}

# ternary
snippet    t
    ${1:/*condition*/} ? ${2:a} : ${3:b}
#case
snippet    case
    case ${1:/*varial case*/}:
        ${2}
        ${3:break;}

# return
snippet    ret
    return ${0};
# for
snippet    for
    for ( ${1:int } ) {
        ${0}
    }
# while
snippet    wh
    while ( ${1:/*condition*/} ) {
        ${0}
    }
#do...while
snippet    do
    do {
        ${0}
    } while { ${1:/*condition*/} };
# typedef enum

##Input/Output
snippet    pr
    printf("${1:%s}"${2});

 上面是我经过修改,更加符合我的习惯。注意得是snippet和关键字之间必须是一个TAB符,不能是空格,否则会报错。

posted @ 2016-07-10 21:03  立体风  阅读(254)  评论(0编辑  收藏  举报