Friday, December 27, 2013

Re: specific colorscheme for help files

On 28/12/13 07:35, Tony Mechelynck wrote:
> On 28/12/13 06:28, Ben Fritz wrote:
>> On Friday, December 27, 2013 3:25:24 AM UTC-6, Steve wrote:
>>>> You could possibly hack a tab-local color scheme using
>>>
>>>> TabEnter/TabLeave autocmds, but there's nothing built in even for
>>>
>>>> that.
>>>
>>>
>>>
>>> Would this be complicated to do?
>>>
>>>
>>>
>>> Thank you for your answer
>>
>> Not complicated. I just whipped this up, it will automatically
>> remember per-tab any colorscheme you set. So just manually set
>> whatever colorscheme on whatever tab you want and it should work.
>> Adjust for your own needs:
>>
>> autocmd ColorScheme * let t:colors_name = g:colors_name
>> autocmd TabEnter * if exists('t:colors_name') && g:colors_name !=#
>> t:colors_name | exec 'colorscheme' t:colors_name | endif
>> autocmd TabEnter * if !exists('t:colors_name') | let t:colors_name =
>> g:colors_name | endif
>>
>
> You could of course group these two TabEnter autocommands into one,
> making the result conceptually simpler at the cost of a longer
> autocommand, as follows (assuming 'nocompatible' so continuation lines
> work). I'm adding an additional autocommand though, to make it work even
> with no :colorscheme statement in the vimrc (or in any custom global
> plugin):
>
> autocmd VimEnter * if !exists('g_colors_name')
> \ | let g:colors_name = 'default'
> \ | endif
> autocmd ColorScheme * let t:colors_name = g:colors_name
> autocmd TabEnter *
> \ if exists('t:colors_name')
> \ | if g_colors_name !=# t_colors_name
-----------------------^-----------------^ oops!
g_ and t_ should of course be g: and t:

> \ | exe 'colorscheme' t:colors_name
> \ | endif
> \ | else
> \ | let t:colors_name = g:colors_name
> \ | endif
>
>
> Best regards,
> Tony.
--
"Every Solidarity center had piles and piles of paper .... everyone was
eating paper and a policeman was at the door. Now all you have to do is
bend a disk."
- an anonymous member of the outlawed Polish trade union, Solidarity,
commenting on the benefits of using computers in support of their
movement

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment