title: Define UltiSnip With Variable Default Placeholder
body: <p>I'm using the excellent <a href="https://github.com/SirVer/ultisnips" rel="nofollow">UltiSnips Vim plugin</a> to help improve my development workflow. I've been using it for several years now, and it has really helped me automate a lot of my redundant typing while coding.</p>
  
  <p>Anyhow: I'm attempting to define a snippet that helps me generate Javascript require statements.</p>
  
  <p>A normal Javascript require statement looks something like this:</p>
  
  <pre><code>let express = require('express');
  </code></pre>
  
  <p>So, here's the snippet I defined:</p>
  
  <pre><code>snippet req "require a module" b
  let ${1} = require('${2}');
  endsnippet
  </code></pre>
  
  <p>This lets me type <code>req</code> in Vim, which will then move my cursor to the <code>${1}</code> position in the snippet so I can define the variable name. Once I hit  a second time, my cursor will be moved to the location of <code>${2}</code> in the snippet, this way I can define the actual Javascript module name to import.</p>
  
  <p>This works fine, but what I'd like to do is take it one step further. I'd like to make a snippet such that:</p>
  
  <p>When I enter a value for <code>${1}</code>, the value <code>${2}</code> is updated to be the value of <code>${1}</code> by default. This way, I can save on typing the same module name twice in certain situations.</p>
  
  <p>The idea is that I should be able to do something like this:</p>
  
  <pre><code>snippet req "require a module" b
  let ${1} = require('${2:${1}}');
  endsnippet
  </code></pre>
  
  <p>This way, if I type:</p>
  
  <pre><code>req&lt;tab&gt;express
  </code></pre>
  
  <p>I should end up with the following expanded line:</p>
  
  <pre><code>let express = require('express');
  </code></pre>
  
  <p>However, it should also work in this situation:</p>
  
  <pre><code>req&lt;tab&gt;exp&lt;tab&gt;express
  </code></pre>
  
  <p>Which would output:</p>
  
  <pre><code>let exp = require('express');
  </code></pre>
  
  <p>Does that make sense?</p>
  
  <p>Anyhow: any help would be appreciated! The code sample above does not work like I thought it would. The <code>${2:${1}}</code> bit is ignored and doesn't work as expected (<em>it doesn't set the placeholder value of <code>${2}</code> to <code>${1}</code></em>).</p>