Closed tlnagy closed 9 years ago
You should check out ColorScheme
event:
augroup limelight_pencil
autocmd!
autocmd ColorScheme * let g:limelight_conceal_guifg =
\ (&bg == 'dark') ? 'red' : 'blue'
augroup END
Thanks! I changed blue to gray and guifg to ctermfg and now it works quite nicely. Would you please explain the red part of the statement? I don't understand what that is doing there, I'm very new to vimscript.
augroup limelight_pencil
autocmd!
autocmd ColorScheme * let g:limelight_conceal_ctermfg =
\ (&bg == 'dark') ? 'red' : 'gray'
augroup END
let g:limelight_conceal_ctermfg = (&bg == 'dark') ? 'red' : 'gray'
Above expression is using a ternary operator, which is equivalent to
if (&bg == 'dark')
let g:limelight_conceal_ctermfg = 'red'
else
let g:limelight_conceal_ctermfg = 'gray'
endif
Does this answer your question or is there anything else that you are unfamiliar with?
Autocommands are one of the most powerful Vim features, which means you'd better understand how to use them before they cause you any trouble.
Don't forget that there's always a :helpgrep
(:help :helpgrep
for more information). Vim's help isn't always the most entertaining read, but most of your answers are there (try issuing :helpgrep ?:
command and navigating quickfix list until you see something similar to the expression above).
I suspected that it was a ternary operator, but I the "concealed" wasn't red when the background was dark so I wasn't sure what was happening. Thanks for the pointers.
@cust0dian Thanks for the excellent answer! @tlnagy Yes, it's a ternary operator. Make sure to put the autocmd in your .vimrc before you choose color scheme. I'll close the issue. Let me know if you can't seem to make it work. Thanks.
I'm coming from Byword and I really enjoy Goyo. I was hoping to replicate Byword's Paragraph Focus mode and Limelight seemed to do the trick. I use two main themes (pencil-light and pencil-dark) and Limelight works fine on the dark theme, but gives me an "Unsupported color scheme" for the light theme. Is it possible to set
limelight_conceal_guifg
per theme? I switch between the modes quite a bit so it would be nice not have to tweak it each time.Thanks for the cool plugin!