I have the following in my .vimrc:

:set colorcolumn=81

This sets the background color of every window's 81st column to red. I would like to disable this for "pop-up" windows like syntastic's error display window or jedi's docstring window. Since buffers similar to these are usually non-modifiable I thought I might be able to only active colorcolumn for modifiable buffers but I can not figure out how.

  • Should be no problem with an autocommand with event, oh, BufReadPost probably. Have it check the newly opened buffer and set colorcolumn only when desired conditions exist. – B Layer Aug 10 at 20:39
  • See my edit, I get what you mean but I'm not sure on the details. – Peter Aug 10 at 20:48
  • All right. Good job. Add it as an answer. – B Layer Aug 10 at 21:05

I'm adding my solution as an answer, the following snippet solves my problem:

autocmd BufWinEnter * call SetColorColumn()

function! SetColorColumn()
    if &modifiable
        set colorcolumn=81
    else
        set colorcolumn&
    endif
endfunction

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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