smart-snippet update: skip field with the same name

November 30, 2007 – 9:34 pm

Consider the following snippet for TeX:


You may want to fill env and go directly to $.. But pressing TAB will bring you to line 3, and then line 2 — where you want to go. Here the problem is when you’ve filled a field, what’s your next action by pressing a TAB?

  1. If there’s next field, go to that field.
  2. If there’s no next field, exit the snippet — go to the place marked by $. , or the end of snippet if no such marker.

That’s it. Consider the 1st rule, why do you want to go to a field? To type something to replace the default value (env here). Then if the next field has the same name as the current field, there’s no need to go to that field — it will be automatically updated when you’re typing in the current field.

So I made an update to smart-snippet, if the next (and the next next, the next next next, etc. if any) field has the same name with the current field, pressing TAB will skip it (or them). However, this new feature may confuse old users. So I made a variable snippet-skip-same-field to disable/enable this feature (disabled by default).

BTW: Someone asked me where’s the mailing list. So I created a discuss group in google groups for smart-snippet.

  1. 2 Responses to “smart-snippet update: skip field with the same name”

  2. It’s perfect !
    This new version is used very well .

    By piteqiu on Dec 4, 2007

  3. I’m very glad to see that you like it. :)

    By pluskid on Dec 4, 2007

Post a Comment