5

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 '16 at 12:04
9

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
  else
    set cc=
  endif
endfun

nnoremap <F2> :call ToggleCC()<CR>
| improve this answer | |

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.