Saturday, April 2, 2011

Re: vim counterpart for persistent includes

Excerpts from Tim Gray's message of Fri Apr 01 17:48:11 +0200 2011:
> <!-- #bbinclude "filename" -->
> file contents that are inlined.
> <!-- end bbinclude -->
This only seems to be useful to me until you learn a proper programming
language / template engine.

If you can't find a plugin for that yet you can script it up easily eg
using

a) getlines (get all lines in a buffer)
b) readfile, writefile
c) matchstr (get part of a string using a regex)


everything else is like iterating over a list of lines:

let idx=0
let new_lines = []
while idx < len(lines)

endwhile

and appending lines to this list:

call add(new_lines, single line)

let new_lines += list_to_append

So even if it does not exist yet it can be done using maybe 10 lines of
VimL code easily.

And if this doesn't work - you can still use any scripting language.

Marc Weber

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment