title: vim: pass a char or word to your function
body: <p>I know that when you define a function in vim, you can use the <code>range</code> keyword so that users can say:</p>
  
  <pre><code>:-5,+5call MyFunction()
  </code></pre>
  
  <p>And then your function gets a:firstline and a:lastline.</p>
  
  <p>What I want is something similar, but more like the traditional vi way of combining a command with a movement, so that 'd ' deletes a space, 'dw' deletes a word, 'd2w' deletes two words, 'd2j' deletes three lines, etc. Assuming my function gets mapped to some input-mode character sequence, is there any way to make it accept similar variable-length inputs, and then modify that text?</p>
  
  <p>Just to be a little more clear, suppose I want to define a function to wrap &lt;b&gt; tags around existing text. We'll say that function is mapped to ;b. I want users to be able to say ';bw' to bold one word, or ';bf.' to bold everything to the end of the sentence, or whatever, with all the flexibility that vim provides to built-in commands.</p>