I know that when you define a function in vim, you can use the range keyword so that users can say:
:-5,+5call MyFunction()
And then your function will receive: firstline and a: lastline.
What I want is something similar, but more like a traditional vi way of combining a command with movement, so that βdβ removes the space, βdwβ removes the word, βd2wβ removes two words: βd2j 'removes three strings, etc. Assuming that my function maps to a sequence of characters in input mode, is there a way to get it to accept similar variable-length inputs, and then change that text?
To be a little more understandable, suppose I want to define a function for wrap <b> tags around existing text. We say that the function maps to: b. I want users to be able to say "; bw" for the boldness of a single word, or "; bf". for boldness, all the way to the end of the sentence or whatever, with all the flexibility that vim provides to built-in commands.
source share