I think it depends on where most of the file processing and decision making is being done and on the scripting facilities available to you outside of Vim. Since most of the processing you're doing seems to be running a sequence of programs, perhaps in a pipeline, I'd be inclined to put all that into a shell script or a batch file and launch that from Vim. (You wrote that you use sed. Do you have access to a Unix shell as well?) If you don't have access to a Unix shell and you find yourself limited by the batch file command set, then you could put all the commands into a Vim function. Putting the commands into a Vim function gives you a little more flexibility and easier programming than trying to quote everything just right for a Vim command or mapping.
You can put shell commands inside functions pretty easily like this
function Foo()
!echo "hello"
endfunction
or this:
function Bar()
call system('echo "hello"')
endfunction
See
:help usr_41.txt
and especially
:help 41.6
:help 41.7
as well as
:help system()
for more on this. For more on commands and mappings, see
:help usr_40.txt
You can write a command to call your function like this:
:command Foo call Foo()
so that you can execute your function with
:Foo
Why not use sed to run the sed commands? – Ignacio Vazquez-Abrams – 2011-04-04T18:48:27.057
That's what I'm doing, but I have to run a few of them, and I have to do it every time I convert a file. I'd like to be able to automate the conversion+several sed commands all at once, preferably from within VIM. – Joe – 2011-04-04T18:58:47.590