title: Scripting inside a mapping
body: <p>Recently I create a mapping to toggle highlight search. That's simple but quite useful, something like <code>nmap ,m :set hlsearch!</code>. The only problem I've been facing is that sometimes I just get lost after pressing <code>,m</code>.</p>
  
  <p>"Did it work?", "Is it now on or off?"… Common question from the panic of not receiving feedback :-)</p>
  
  <p>So I thought that echoing a "turned on" or "off" would make me calmer. The big question here now arrived: is it possible to include a little script inside the mapping? I know I could create a function, but that's not my intention for this simple script:</p>
  
  <pre><code>if (&amp;hlsearch)
      echo "Search Highlight On"
  else
      echo "Search Highlight Off"
  endif
  </code></pre>
  
  <p>I guess that I need to "escape" the newlines like in a preprocessor directive, maybe:</p>
  
  <pre><code>nmap ,m :set hlsearch!              \
      if (&amp;hlsearch)                  \
          echo "Search Highlight On"  \
      else                            \
          echo "Search Highlight Off" \
      endif
  </code></pre>
  
  <p>But probably that's not the proper way, doesn't work and I don't even know if it is possible.</p>
  
  <p>Another thing I notice is that typing things like <code>:if (1) echo "works"</code> doesn't work either, even though both <code>if</code> and <code>echo</code> are "colon" commands. It gives an error with <code>echo</code>. So do I need to separate each command in some way? Preceding <code>echo</code> with another colon didn't solve the problem.</p>
  
  <p>Thanks for any help!</p>