On 12/01/09 15:14, Yue Wu wrote: > On Mon, 12 Jan 2009 22:10:06 +0800, Tony Mechelynck > <[email protected]> wrote: > >> function SaveCursorColor() >> redir => highlight >> silent hi Cursor >> redir END >> if highlight =~ 'links to ' >> let s:hl-link = matchstr(highlight, 'links to \zs\S*') >> elseif highlight =~ '\<cleared\>' >> let s:hl-link = 'NONE' >> else >> let s:hl-link = '' >> for substr in ['term', 'cterm', 'ctermfg', 'ctermbg', >> \ 'gui', 'guifg', 'guibg', 'guisp'] >> if highlight =~ substr . '=' >> let s:hl-{substr} = matchstr(highlight, >> \ substr . '=\S*') >> else >> let s:hl-{substr} = '' >> endif >> endfor >> endif >> endfunction >> function RestoreCursorColor() >> if !exists('s:hl-link') >> echoerr 'Cursor not saved, cannot restore' >> return >> endif >> hi clear Cursor >> if s:hl-link == '' >> exe 'hi Cursor' s:hl-term s:hl-cterm s:hl-ctermfg >> \ s:hl-ctermbg s:hl-gui s:hl-guifg s:hl-guibg >> \ s:hl-guisp >> elseif hl-link != 'NONE' >> exe 'hi link Cursor' s:hl-link >> endif >> endfunction > > It's too complicated, if I want to save/restore highlight for others, > it would need a big change. No other simple and generic way? >
Tell you users to do ":hi Cursor", write down the result, and restore it by hand when needed. Best regards, Tony. -- "I think sex is better than logic, but I can't prove it." --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
