Monday, March 1, 2010

Re: Programmatically detect a current "highlight" setting?

On 01/03/10 08:42, Wincent Colaiuta wrote:
> I'm writing a plug-in and want to temporarily hide the cursor.
>
> It would be really neat if I could do "highlight Cursor NONE" and
> later restore the highlight setting to whatever it was before.
>
> But I am not sure how to capture the old setting. Evidently "highlight
> Cursor" _echoes_ the current setting, but doesn't actually return
> anything that I could capture programmatically.
>
> Anything I can do?
>
> Cheers,
> Wincent
>

see
:help :redir

You should reformat the captured string(s) to remove the xxx and add
:hi! at the start.

A couple of caveats:
- a different reformat will be needed for a linked group, to replace
"foo xxx links to bar" by "hi! link foo bar"
- You may need to prefix the capturing :hi command by 0verbose in order
to make sure that your screen capture does _not_ include where the
highlight was defined (see :help :verbose).


Best regards,
Tony.
--
To understand this important story, you have to understand how the
telephone company works. Your telephone is connected to a local
computer, which is in turn connected to a regional computer, which is
in turn connected to a loudspeaker the size of a garbage truck on the
lawn of Edna A. Bargewater of Lawrence, Kan.

Whenever you talk on the phone, your local computer listens in. If it
suspects you're going to discuss an intimate topic, it notifies the
computer above it, which listens in and decides whether to alert the
one above it, until finally, if you really humiliate yourself, maybe
break down in tears and tell your closest friend about a sordid
incident from your past involving a seedy motel, a neighbor's spouse,
an entire religious order, a garden hose and six quarts of tapioca
pudding, the top computer feeds your conversation into Edna's
loudspeaker, and she and her friends come out on the porch to listen
and drink gin and laugh themselves silly.
-- Dave Barry, "Won't It Be Just Great Owning Our Own
Phones?"

--
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