tags:

views:

95

answers:

1

Okey, simple problem, but I'm stupid and am not seeing it.

Can somebody give me an example what needs to be done to create a new snippet (preferably if someone could give a simple example) for a new language in XPTemplate (Vim plugin).

Its syntax files are a total mess from my point of view.

A: 

Reading the documentation is always a good way to start. In doc/xpt.snippet.syn.txt you'll see details on the syntax of their template files.

 A snippet file looks like this : >
     XPTemplate priority=lang keyword=$ | |xpt-snippet-header|

     let s:f = XPTfuncs()   | |xpt-snippet-function|

     XPTvar $TRUE          true  | |xpt-snippet-variable|
     XPTvar $FALSE         false             |
     XPTvar $NULL          null              |
     XPTvar $UNDEFINED     undefined         |
                                                        |
     XPTvar $CL  /*                          |
     XPTvar $CM   *                          |
     XPTvar $CR   */                         |
                                                        |

     XPTinclude    | |xpt-snippet-XPTinclude|
           \ _common/common                  |
           \ _comment/doubleSign             |
           \ _condition/c.like               |

     fun! s:f.js_filename()   | |xpt-snippet-function|
      return expand( "%" )            |
     endfunction                             |

     XPTemplateDef    | |XPTemplateDef|


     XPT cmt hint=/**\ @auth...\ */  | |xpt-snippet|
     XSET author=$author                     | |xpt-snippet-XSET|
     XSET email=$email                       | |xpt-snippet-XSET|
     /**                                     |\ 
     * @author : `author^ | `email^          | \
     * @description                          |  +|xpt-snippet-body|
     *     `cursor^                          | /
     * @return {`Object^} `desc^             |/
     */


     XPT for hint=for\ (var..;..;++) 
     ... 

I personally prefer NerdSnippets which has a very simple snippet template syntax.

Pierre-Antoine LaFayette
Of course. And naturally, I wouldn't ask it were it clear from the help. Unfortunatelly, although the snippet syntax help file is in the help, the "syntax tutor" is still unwritten, and I'm having problems finding out what goes where (the general organisation). That's why I asked for an example if anyone has perhaps written some.
ldigas