On 20/04/09 11:05, Dennis Benzinger wrote:
>
> 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
I think that not clearing previous output is a known limitation or bug
of the ":echo" command. To clear the output, you can (untested) start
your echo by a carriage-return, e.g. with
:echo "\n" . Hi_get_info()
Best regards,
Tony.
--
THE LESSER-KNOWN PROGRAMMING LANGUAGES #2: RENE
Named after the famous French philosopher and mathematician Rene
DesCartes, RENE is a language used for artificial intelligence. The
language is being developed at the Chicago Center of Machine Politics
and Programming under a grant from the Jane Byrne Victory Fund. A
spokesman described the language as "Just as great as dis [sic] city of
ours."
The center is very pleased with progress to date. They say they have
almost succeeded in getting a VAX to think. However, sources inside the
organization say that each time the machine fails to think it ceases to
exist.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---