Re: [dev] [sandy] Implement copy/paste/replace?

From: Charlie Kester <>
Date: Mon, 14 Jul 2014 09:50:21 -0700

On Mon 14 Jul 2014 at 08:47:14 PDT Dimitris Zervas wrote:
>Hello guys,
>I just wanted your opinion in implementing a feature inside the code
>or calling it via sh.
>Which are the advantages for calling a script?
>Isn't it performance killer?

The reason many editors took so many features onboard is that shelling
out was noticeably slow on the machines that were available at the time.

I'm not sure that motivation is still valid today. For example, I often
invoke par, fmt, align, etc. from vim when I need to reformat text and I don't
see any discernable difference in speed doing it this way rather that using
vim's builtin gq command.

Advantages of shelling out include the fact that the code delegated to
the script or other process can be unloaded once it's finished and no
longer needed. So the working set is smaller than if the editor is
statically linked to this functionality, or if it loads it from a shared
library at startup. And the mechanics and overhead of shelling out
seems at first glance to be less burdensome than dynamically loading and
unloading shared libraries.

But maybe the same hardware improvements which make the time to shell out no
longer a concern also make the size of the working set a non-concern?

So perhaps the decision should come down to issues of code complexity
and flexibility.

The more a program delegates to external programs, the simpler its own code
will be.

Flexibility, on the other hand, will depend on the interface between the
program and the external programs it invokes. This shouldn't be a
problem here, since we're talking text editors and the Unix conventions
for passing streams of text through pipes are well known and well

Your question is an interesting one. It has me looking at the internal
commands I do still use in vim and wondering how they might be implemented as
external programs.

One thing an editor could do to improve on vi(m)'s "!" command, btw,
is to pass arbitrary ranges of text to the external command, instead of
a range of *lines*.
Received on Mon Jul 14 2014 - 18:50:21 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 14 2014 - 19:00:10 CEST