title: Snippets vs. Abbreviations in Vim
body: <p><strong>What advantages and/or disadvantages are there to using a "snippets" plugin, e.g. <a href="https://github.com/ervandew/snipmate.vim" rel="noreferrer">snipmate</a>, <a href="https://github.com/SirVer/ultisnips" rel="noreferrer">ultisnips</a>, for VIM as opposed to simply using the builtin "<a href="http://vim.wikia.com/wiki/Using_abbreviations" rel="noreferrer">abbreviations</a>" functionality?</strong> </p>
  
  <p>Are there specific use-cases where declaring <code>iabbr</code>, <code>cabbr</code>, etc. <em>lack</em> some <strong>major</strong> features that the snippets plugins provide? I've been unsuccessful in finding a thorough comparison between these two "features" and their respective implementations.</p>
  
  <p>As @peter-rincker pointed out in a comment:</p>
  
  <blockquote>
    <p>It should be noted that abbreviations can execute code as well. Often via <code>&lt;c-r&gt;=</code> or via an expression abbreviation <code>(&lt;expr&gt;)</code>. Example which expands @@ to the current file's path: <code>:iabbrev @@ &lt;c-r&gt;=expand('%:p')&lt;cr&gt;</code></p>
  </blockquote>
  
  <p>As an example for python, let's compare a snipmate snippet and an abbrev in Vim for inserting lines for class declaration.</p>
  
  <h3>Snipmate</h3>
  
  <pre><code># New Class
  snippet cl 
    class ${1:ClassName}(${2:object}):
      """${3:docstring for $1}"""
      def __init__(self, ${4:arg}):
        ${5:super($1, self).__init__()}
        self.$4 = $4 
        ${6}
  </code></pre>
  
  <h3>Vimscript</h3>
  
  <pre><code>au FileType python :iabbr cl class ClassName(object):&lt;CR&gt;&lt;Tab&gt;"""docstring for ClassName"""&lt;CR&gt;def __init__(self, arg):&lt;CR&gt;&lt;Tab&gt;super(ClassName, self).__init__()&lt;CR&gt;self.arg = arg
  </code></pre>
  
  <p>Am I missing some fundamental functionality of "snippets" or am I correct in assuming they are overkill for the most part, when Vim's <code>abbr</code> and <code>:help template</code> templates are able to do <s>all</s> <em>most</em> of the stuff snippets do?</p>
  
  <p>I assume it's easier to implement snippets, and they provide additional aesthetic/visual features.  For instance, if I use <code>abbr</code> in Vim and other plugins for running/testing python code inside vim--e.g. <a href="https://github.com/scrooloose/syntastic" rel="noreferrer">syntastic</a>, <a href="https://github.com/alfredodeza/pytest.vim" rel="noreferrer">pytest</a>, <a href="https://github.com/python-rope/ropevim" rel="noreferrer">ropevim</a>, <a href="https://github.com/jcrocholl/pep8" rel="noreferrer">pep8</a>, etc--am I missing out on some key features that snippets provide?</p>