I have read the manual in vim with :h cc or h: 'cc', but I found nothing about how to remove the red lines.

First use case

I create the red line with this command:

:set cc=1,5,9,13,17,21

With the following command I can disable cc ,or to remove all the red lines created by the previous command:

:set cc-=1,5,9,13,17,21  "Use minus `-` to remove all the red lines here.

Is there a more quickly way to remove all the red lines?

Use case 2

I create the red line with this command:

:exec "set cc=".join(range(1,21,4),",")

How to deactive cc command in this case?

enter image description here

  • 2
    I.e. read the picture text ad litteram :)
    – VanLaser
    Mar 23, 2016 at 12:04

1 Answer 1


You can clear all the lines by just setting cc to an empty value like so:

:set cc=

You also can create a command or mapping to toggle between the two, &cc refers to the cc setting, we need to use let since we want to use an expression:

command! ToggleCC :let &cc = &cc == '' ? '1,4,21' : ''

nnoremap <F2> :let &cc = &cc == '' ? '1,4,21' : ''<CR>

If &cc is empty, we set it to 1,4,21, if it has a value, we set it to nothing.

This is really a shorter version of the longer:

fun! ToggleCC()
  if &cc == ''
    set cc=1,4,21
    set cc=

nnoremap <F2> :call ToggleCC()<CR>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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