On Jan 28, 8:24 am, Nicolas Aggelidis <[email protected]> wrote:
> A lot of times the documentation of varius functions vary  very
> little, so instead of copy-pasting alot
> of stuff , i thought to use a function (or maybe a placeholder) for
> this that will generate documentation
> dynamically. So what i want is to be able to take a file, and produce
> another one, by processing some special lines,
>         while leaving all other lines intact. The original file will contain
> the special placeholders while the produced file
>         will not contain the placeholders but the final documentation.

There are any number of ways this could be done: perl, sed, awk,
etc... If I were going to do it entirely with Vim, I would create a
mapping that invokes a Vim function, whose job is to perform the
appropriate regex substitutions on the current buffer.
:help :map
:help :function
:help pattern

Brett S.
>
> $cat initial_file.sh
>
> generate_documentation parameter1 parameter2 parameter3
> function func1()
> {
>         <...>
>
> }
>
> generate_documentation another_parameter1 another_parameter2 
> another_parameter3
> function func2()
> {
>         <...>
>
> }
>
> $cat altered_file.sh
>
> #       ...
> # documentation based on
> #                  parameter1 parameter2 parameter3
> #       ...
> function func1()
> {
>         <...>
>
> }
>
> #       ...
> # documentation based on
> #                  another_parameter1 another_parameter2 another_parameter3
> #       ...
> generate_documentation another_parameter1 another_parameter2 
> another_parameter3
> function func2()
> {
>         <...>
>
> }
>
> Which tool will be the most appropriate for the job? any ideas? (...or
> even solutions :)  )
>
> I am not sure i did correctly posting to vim-use, but i couldn't think
> any other mailing list relevant to text processing...
>
> best regards,
>      nicolas
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to