Hi!

I have the follwing code in my .vimrc to display the highlighting at the
cursor position:

function Hi_get_info()
    let syn_name = synIDattr(synID(line("."), col("."), 1), "name")

    if len(syn_name) == 0
        return ""
    endif

    let info = syn_name

    let orig_ignorecase = &ignorecase
    let &ignorecase = 0

    while 1
        redir => hi_output
        silent execute "hi " . syn_name
        redir END

        let matches = matchlist(hi_output, '\w\+\s\+xxx\( links
to\)\?\(.*\)')

        if (matches[1] ==# " links to")
            let link_name = matches[2]
            let info .= " >" . link_name
            let syn_name = link_name

        else
            let info .= matches[2]
            break

        endif
    endwhile

    let &ignorecase = orig_ignorecase

    return info
endfunction

map <silent> <F4> :echo Hi_get_info()<CR>

The problem is that when I press F4 the output is sometimes printed
without clearing the previous output. For example sometimes I get:

vvimLet > vimCommand > Statement term=bold ctermfg=6 guifg=darkorange

Notice the extra v at the beginning. If I remove <silent> from the map
command then the output is OK. But I don't like it that then the command
is shown.

Do I have to clear the previous output somehow?


Dennis Benzinger

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

Reply via email to