VIM SnippetsEmu vs TextMate Snippets

textmate_vs_vim.png
Snippets have become one of the must-have features in text editors thanks mainly to TextMate. Most editors now have
their own version of them; of course TextMate has it’s snippets capability built-in by default, Emacs has
snippet.el, VIM has the SnippetsEmu script (and some others but not as
good as SnippetsEmu), and so forth for other text editors. However while each
implementation has the same basic function, each accomplishes it in different ways, here’s a contrast between
TextMate’s and VIM’s SnippetsEmu:

    TextMate

  • has place-holders
  • has tab-triggers
  • has mirroring
  • can go forwards and backwards
    VIM

  • has place-holders
  • has tab-triggers
  • has mirroring

So as you can see; VIM with a simple script can accomplish everything that TextMate can except for being
able to go backwards (you can go down to the fourth line with $1, and then put $2 on the second line
that will take you from the fourth line to the second line).

TextMate also has the better of VIM in that it’s interface for creating new snippets is very nice and very simple, and also has the ability to utilize TextMate’s scoping feature.

VIM’s can seem a little more difficult at first but after a little use; it becomes just as easy. One plus for VIM is that with
SnippetsEmu when you’re inside an expanded snippet and want to put in another snippet, it will open up the new
snippet and then after can continue onto the original one.

For example here are two different snippets for Perl, one being the
sub snippet and the other being my own print snippet (the “< {}>” signifies where the cursor will go after a tab trigger.)


    sub $george {
        print
    }
    < {}>

Once I hit the tab on the end of print it would open the
snippet like it should.

TextMate however would continue on in the original snippet, which would most likely be after the print, and
then you would have to go back to the print and finish that snippet.

Another plus for VIM is that both the
editor and the script is free, and you are free to change either yourself and on the other hand you have to
fork over some cash for TextMate and you can’t change the code on either the editor or the implementation of
snippets.


 
 

Post a comment to "VIM SnippetsEmu vs TextMate Snippets"



Support MacTips

MacTips Newsletter


Random Popular Tips

Recent Comments

Recent Discussions

MacTips Poll

What level of tips would you like to see?

View Results

Loading ... Loading ...

Friends of MacTips

Subscribe to MacTips

Site Links