title: mapping the shift key in vim
body: <p>I'm having an issue when mapping the <kbd>Shift</kbd> key in VIM. I want <kbd>Ctrl</kbd>+<kbd>L</kbd> to behave differently than <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>L</kbd></p>
  <p>so I have this</p>
  <pre><code>&quot; for insert mode remap &lt;c-l&gt; to:
  &quot; Insert a hash rocket  for ruby
  &quot; Insert a -&gt; for php
  &quot; for coffee the shift key decides
  
  function! SmartHash(...)
    let shift = a:0 &gt; 0
    let ruby = &amp;ft == 'ruby'
    let php = &amp;ft == 'php'
    let coffee = &amp;ft == 'coffee'
  
    if php
      return &quot;\-&gt;&quot;
    end
  
    if coffee
      return shift ? &quot;\ =&gt;\n&quot; : &quot;\ -&gt;\n&quot;
    end
  
    if ruby
      return &quot;\ =&gt; &quot;
    end
  
    return &quot;&quot;
  
  endfunction
  
  imap &lt;c-l&gt; &lt;c-r&gt;=SmartHash()&lt;cr&gt;
  imap &lt;C-S-L&gt; &lt;c-r&gt;=SmartHash(1)&lt;cr&gt;
  </code></pre>
  <p>...but it's just triggering the second mapping whether I have the <kbd>Shift</kbd> key pressed or not.</p>
  <h3>Updated based on <a href="https://stackoverflow.com/a/10345866/80559">accepted answer</a></h3>
  <pre><code>&quot; for insert mode remap &lt;c-l&gt; to:
  &quot; Insert a hash rocket  for ruby
  &quot; Insert a -&gt; for php and coffeescript
  &quot; double tapping does alternate symbol for php and coffescript
  function! SmartHash(...)
    let alt = a:0 &gt; 0
    let ruby = &amp;ft == 'ruby'
    let php = &amp;ft == 'php'
    let coffee = &amp;ft == 'coffee'
  
    if php || coffee
      return alt ? &quot;\ =&gt;\n&quot; : &quot;\ -&gt;\n&quot;
    end
  
    if ruby
      return &quot;\ =&gt; &quot;
    end
  
    return &quot;&quot;
  
  endfunction
  
  imap &lt;c-l&gt; &lt;c-r&gt;=SmartHash()&lt;cr&gt;
  imap &lt;c-l&gt;&lt;c-l&gt; &lt;c-r&gt;=SmartHash(1)&lt;cr&gt;
  </code></pre>