I know there is a short cut to make the fill column indicator visible. But I want it visible a most of the time anyway. Can I set an option or call a function to toggle it automatically at startup?

I have used :nmap [SPC]tf to show what the key binding does. But I can't understand the result (quite new to vim):

n  [SPC]tf     * :<C-U>call call(function('<SNR>32_toggle_colorcolumn'), [])<CR>

I have done some more research as suggested by @filbranden. :scriptname 32 reveals the function:

function! s:toggle_colorcolumn() abort
  if !s:ccflag
    let &cc = g:spacevim_max_column
    let s:ccflag = 1
    set cc=
    let s:ccflag = 0
  call SpaceVim#layers#core#statusline#toggle_mode('fill-column-indicator')

This seems to toggle a script local boolean s:ccflag (not sure about the script local part) and then calls a function. Setting the ccflag in my bootstrap function and calling the toggle_mode() function did nothing.

  • There's this a little above this snippet: if &cc ==# '80' and let s:ccflag = 1, so maybe set cc=80 in your early initialization is enough to set it on and keep SpaceVim state consistent? It's odd that that doesn't necessarily match g:spacevim_max_column...
    – filbranden
    Nov 28, 2020 at 16:51
  • Consider filing an issue on SpaceVim's GitHub. The author is pretty responsive and should know best how to set this up at initialization. Refer to this question there as well, the author answers questions here so they might be able to post an answer too. Cheers!
    – filbranden
    Nov 28, 2020 at 16:59
  • Yeah, I investigated that cc setting. Does exactly what I need. It only makes the toggle stumble a bit. If you hit the key binding for the first time after start, it sets cc to g:spacevim_max_column, since the flag isn't set and therefore does not make the columns disappear. I have cc=80 now as well as g:spacevim_max_column.
    – 80KiloMett
    Nov 28, 2020 at 17:00
  • 1
    I'll update my answer. For now it's only a minor caveat to me that the toggling doesn't work. I'll probably file an issue to have a more easily accessible option. Or maybe there's something we both missed.
    – 80KiloMett
    Nov 28, 2020 at 17:03
  • 1
    @filbranden Oh, and thanks for helping.
    – 80KiloMett
    Nov 28, 2020 at 17:34

1 Answer 1


I found a solution: I added the following line to my bootstrap_before function

call <SNR>32_toggle_colorcolumn()

This comes with the caveat that the function name is likely subject to change.

The above mentioned function sets a variable called cc Adding the following to the bootstrap function brings up a fill columns indicator (colorcolumn):

set cc=80

The above setting adds a colored column at column 80. More information under :help colorcolumn. This comes with the caveat that the key binding to toggle the color column doesn't work as expected. For best results also set max_column=80 under options in ~/.SpaceVim.d/init.toml. Both settings together result in having to hit the toggle shortcut <Space>tf twice to make the column disappear, but only the first time after the editor is started.

I filed this as an issue. In case I forget about this question, people can have a look for nicer solutions there.

  • The problem with this approach is that it relies on the script defining this function being the 32nd one to be loaded... This is quite likely to change as you reconfigure anything, or even with upgrades of SpaceVim itself... There might be better ways to accomplish the same.
    – filbranden
    Nov 28, 2020 at 15:44
  • 1
    Thought that it looked shady. That's why I didn't mark this as solved yet. Maybe I'll have a look at where this function is defined.
    – 80KiloMett
    Nov 28, 2020 at 15:56
  • You can use the :scriptnames command and see which script is number 32. (Please edit the question and include that information. That might help figure out what that function is doing, and how to enable it by default.)
    – filbranden
    Nov 28, 2020 at 16:14

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.