Hi Bee!

On Fr, 19 Feb 2010, Bee wrote:

> I just wanted to learn more about redir and to see if I could redirect
> the output of  :highlight thru TOhtml  to create an HTML file thus
> saving the color content.

Not directly I am afraid. But you could do something like this:

fu! <sid>Syntax()
    tabnew
    " maximize (so we don't have to take care of line breaks hopefully)
    if &columns<100
    let &columns=9999
    endif
    redir =>hi | sil hi | redir end

    let list=split(hi,"\n")
    call append('.', list)
    1d
    let i=1
    while i < line('$')
    exe 'syn match'  matchstr(list[i-1], '^\S\+') ' /^\S\+\s\+\zs\%' . i . 
'l.*$/'
    let i+=1
    endw
    TOhtml
endfu

com! -nargs=0 Hi :call <sid>Syntax()



regards,
Christian
-- 
hundred-and-one symptoms of being an internet addict:
94. Now admit it... How many of you have made "modem noises" into
    the phone just to see if it was possible? :-)

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to