On 01/03/09 03:15, vimim wrote:
>
>
> On Feb 28, 4:11 pm, Matt Wozniski<[email protected]>  wrote:
>> On Sat, Feb 28, 2009 at 6:50 PM, Sean wrote:
>>> It is possible to save/restore highlight settings in a plugin?
>> I don't think I understand the question...
>>
>>>      (1) save highlight option  (How ?)
>>>      (2) highlight lCursor guibg=green
>>>      (3) restore highlight option  (How ?)
>> What would you expect that example to do?
>>
>> ~Matt
>
>
> Basically, I want to know if it is possible to do (1) and (3) below
>
> (1) let s:saved_highlight=&ICursor
> (2) highlight lCursor guibg=green
> (3)&ICursor=s:saved_highlight
>
> Step (2) is correct, and is what I want, from within my plugin.
> However, I don't want to set it permanently for all vim session.

The following is untested, but I think that (in a filetype-plugin or 
similar) it will do what you want. (Redirection to a variable may 
require Vim version 7.)

function SetGreenLCursor()
        redir => b:save_lch
                silent hi lCursor
        redir END
        let b:save_lch = substitute (b:save_lch, '\<xxx\>', '', '')
        hi lCursor ctermbg=green guibg=green
endfunction
function RestoreGreenCursor()
        if exists('b:save_lch')
                exe 'hi' b:save_lch
                unlet b:save_lch
        else
                echoerr 'Trying to restore cursor before saving'
        endif
endfunction
call SetGreenCursor() " first time: we have already entered the buffer
au BufEnter <buffer> call SetGreenCursor()
au BufLeave <buffer> call RestoreGreenCursor()


Best regards,
Tony.
-- 
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
                -- Random Shack Data Processing Dictionary

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

Reply via email to