Which command should I add in the script to tell vi to embed it in the
correct place?

At the moment I do it by telling vi something like "go to line XXX,
delete everything, insert text":

:386,$d
o <CTRL + v + ESC>
:r /tmp/arXiV_2.txt
:w! ~pau/WWW/arXiV.html

But the inconvinient is that I have to modify the vim script whenever
I add something to the web page, the number line 386 is wrong... and
it is very tedious

Well, rather than a fixed line number, you can have some unique token in your file. E.g., you can have a unique comment to mark the start of the content...something like

<!-- CONTENT GOES HERE -->

Then, instead of ":386,$d", you can do

        :/CONTENT GOES HERE/+,$d

That finds the line containing that text ("/CONTENT GOES HERE/"), and then deletes ("d") from the following line ("+") to the end of the file ("$").

More details can be found at

        :help :range

HTH,

-tim





Reply via email to