3

I've looked at Vim 80 column layout concerns and Showing a different background colour in Vim past 80 characters and tried the solutions provided there. They seem to work, however, only for some simple ordinary .vimrc's, not for spf13.

When I add, say,

set textwidth=80
set colorcolumn=+1

to a simple .vimrc, I get

enter image description here

But when I try to add these two lines to ~/.vimrc.local (as mentioned in spf13) for customization, I get nothing. Do I need to set something else like ~/.vimrc.before?

I'm not sure if my way of customization is too naive, or if there is already some instruction on this that I've missed. Has anyone succeeded in setting a different background color or layout for columns beyond 80 when using spf13? Thanks.

BTW I'm using VIM 7.3 on UBUNTU 12.04.

3

The problem seems to be in Solarized. If I comment out color solarized in .vimrc it works.

On a normal vim install :highlight ColorColumn gives me:

ColorColumn    xxx term=reverse ctermbg=1 guibg=LightRed

And the xxx example shows a red background, but with Solarized it gives me:

ColorColumn    xxx ctermbg=235 guibg=DarkRed

and the xxx example shows as normal text (black on white in my case).

I didn't really investigate the cause of this; but I fixed it by adding this to the .vimrc.local:

set textwidth=80
set colorcolumn=+1

highlight ColorColumn term=reverse ctermbg=1 guibg=LightRed
augroup colorcolumn
    autocmd!
    autocmd ColorScheme solarized highlight ColorColumn term=reverse ctermbg=1 guibg=LightRed
augroup end

The autocmd isn't strictly required, but if you change colour schemes all highlights are reset, so this makes sure it applies the fix again.

  • This seems still not working for me. But thanks anyway. – Vincent Gao Mar 4 '16 at 23:56
  • @WanxinGao Does it work if you uncomment the color solarized? If not, try disabling the plugins that SPF13 includes and see if that fixes it... – Martin Tournoij Mar 5 '16 at 0:06
  • Yeah. My bad. After commenting out color solarized it finally works. Actually I also uncommented it back and then it is now all OK with Solarized. – Vincent Gao Mar 6 '16 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.