[Viplugin-devel] Re: Vi(m) plugin
Brought to you by:
midramas
|
From: Michael B. <zed...@sa...> - 2003-07-02 12:41:43
|
On Wed, Jul 02, 2003 at 12:43:06PM +0100, Whiles, Philip wrote:
> Michael,
>
> Much as I would like to do the regex replace, I think it may take me some
> time to get round to it.
> I had a quick look today at your code, and while I can see where I would
> need to add additional code, never having developed and debugged a plugin,
> it is going to take me a while. (Having imported the code as a plugin
> project, I assume you run as a runtime workbench - does that pick up the
> newly compiled plugin automatically, or do you have to export it before
> starting the runtime w.b. ? I assume you can debug the runtime w.b. ?)
You can just start the runtime workbench! It will tell you that you have
duplicate plugins. If you want to get rid of this message then change
the configuration for the runtime workbench and deselect the viPlugin
you use in the "real" workbench :)
>
>
> If you have the time and energy at the moment, you go ahead. (I am keen to
> see this functionality added, as the regex replace in Vim is one of the
> things that adds real power to the editor.)
Yes I have time, but I'm currently hitting my head against a brick wall
thinking about a commercial Eclipse plugin. The best idea I had is for
free (viPlugin :)
>
> I don't think this is going to be a 5 minute job btw, (depending on how much
> you decide to implement), as the command will need to be parsed itself, and
> applied to a line range as well as multiple times within a line ie to
> support :
The range is an improvement of the CommandParser and is not related to
the search/replace mechanism.
>
> :.,10s/this/that/g
> :%s/this/that/
> :10,$s/this/that/g
Those are really easy :)
>
> while the search pattern "this" will be easy to apply using java.util.regex,
> the application of the replace in all its glory will be harder, unless you
> only support a simple text replacement. ie "that" could include regex
> command characters as well as simple characters.
>
> ie
>
> :2,12s/\(this\)\( and \)\(that\)/\3\2\1/g
Now that lets my body shiver :)
I never used something like that and I'm not a regexp expter too, so I
don't event see what the benefit is. Implementation is not as tricky as
you might think, but may be slow!?
>
> "this and that" becomes "that and this" (I don't mean to teach egg sucking,
> just trying to illustrate my point you understand!)
sure :)
>
>
> How/What would you implement it ?
At first I would add range capability to CommandParser, then I would
implement simple replacement (without undo), the undo, then regexp. But
I'm going to wait a few days to get some more bug reports before I add
additional functionality (which should go in after 0.2.0)!
>
> Regards
>
> Phil Whiles
cu,
Michael
|