2013-06-04 01:16, Andrei Olsen skrev:
And finally... let's take a look at the snippet in question:

snippet h1 <h1 id="${1:heading}">${2:$1}</h1>

You type h1<TAB> and you'll get <h1 id="heading">heading</h1>.
Cursor at the first tabstop and id value is highlighted and
ready to be replaced. Now you type a new value (it should not,
actually must not, contain spaces; but no one is forcing you to
type spaces here), this value is also used as a placeholder for
next and final tabstop. You hit <TAB>, cursor moves to the
second tabstop (element's text node), text is again highlighted
and ready to be replaced. You type a new heading.

Personally, I see no value in using the first variable as a
placeholder for the second (for header tags anyway). I much
more prefer the way it's done in this snippet file (it also has
a final tabstop outside the closing tag):

https://gist.github.com/smt/1112952

Absolutely. There is nothing stopping you (Steve) from defining
your own snippets to replace/override the default ones. check the
syntax section under :h SnipMate, it's fairly easy. I have
actually removed the packaged snippets for the languages I use,
and defined my own such that I really need, for the languages I
use. I also put each snippet in its own file since firstly I'm no
fan of literal tabs and secondly I find that to make my snippet
housekeeping easier: since you probably know the trigger of the
snippet it's way easier to find the file than to search through a
long file with many snippets like in that gist.

The idea to define separate snippets for <h?> w/o class and/or id
attributes, and to use # and . in the triggers I totally like!

Another tip: make sure your snippet triggers end with a non-
letter, lest you accidentally activate them! I give my snippets
triggers like 'for-' since it's ecceedingly uncommon that you
actually write a word ending in a hyphen and then hit tab.

So I'd have one file 'h#-.snippet' containing

<h${1:2} id="${2:id-text}">${3:heading text}<h$1>
${4}

and so on. (I don't know about you but 60% of all <h?> I ever
write are <h2>...)

/bpj

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to