On 5/5/06, Zdenek Sekera <[EMAIL PROTECTED]> wrote:
I have this problem (trivially simplified a real case):let a="a\nb\nc" When echo'ing it, it displays lines: :echo a a b c Now I need to call system() and have the contents of 'a' as the file, without actually writing the 'a' into a temp file, something like this: execute "system(". editor . " " . file .")" where 'editor' is a variable containing the editor name, could be let editor=gvim and 'file' is *the something* containing the lines from the variable 'a'.
Yes you can do it without temp file. Use 'vim -' trick: vim reads contents from standard input. Details of how to provide standard input to "gvim -" are up to you, but the simplest is t use ':call system(editor.' -', input)'. This is not the only methos though; details will vary depending on the OS. 1. :call system(editor.' -', a) this will work both on windows and linux 2. :let X=a| exe "! echo "$X" | ".editor".' -' this will work on linux; I'm not sure this will work on Windows. Anyway, $X shall be changed to %X% but I'm not sure Windows env.vars. can contain newlines. On linux, this works. Yakov
