title: Move to start and end of text on home and end keys
body: <p>I want to be able to move to the start and to the end of the non-whitespace text of a line just by pressing <code>&lt;home&gt;</code> and <code>&lt;end&gt;</code>. I got it already up and running with <code>&lt;home&gt;</code>:</p>
  
  <pre><code>" &lt;home&gt; goes to the beginning of the text on first press and to the
  " beginning of the line on second press. It alternates afterwards.
  nn &lt;expr&gt; &lt;home&gt; virtcol('.') - 1 &lt;= indent('.') &amp;&amp; col('.') &gt; 1 ? '0' : '_'
  </code></pre>
  
  <p>But I just can't get it up and running for <code>&lt;end&gt;</code>:</p>
  
  <pre><code>" &lt;end&gt; goes to the end of the text on first press and to the end of the line
  " on second press.
  nn &lt;expr&gt; &lt;end&gt; virtcol('.') &lt; virtcol('$')-1 ? virtcol('$')-1 : winwidth(0)-1
  </code></pre>
  
  <p>The cursor does not move when I press <code>&lt;end&gt;</code>. But if I press <code>:</code> afterwards, the text <code>:.,.+x</code> appears, where <code>x</code> is the return value of the above expression. This command moves between lines and not between a column as it is intended by me.</p>
  
  <p>Can anyone tell me what I'm doing wrong in the second case? As a note, I have to say that I have configured <code>virtualedit=all</code>, which means I can move the cursor after the length of the text of a line.</p>