Question

I tried to hide a foldcolumn in VIM via .vimrc :

set foldcolumn=0

but it doesn't work. It always appears as an extra column.

Commenting "set foldcolumn=0" didn't work too.

Was it helpful?

Solution

As a buffer-local option, 'foldcolumn' is probably set by a filetype plugin, especially because its global default value is 0.

When the fold column appears, find out where it got set via :verbose setlocal foldcolumn?. Then, e.g. when it was set by ftplugin/cpp.vim, you can put the following into ~/.vim/after/ftplugin/cpp.vim:

:setlocal foldcolumn=0

The after directory allows to override filetype-specific settings without modifying the original script.

OTHER TIPS

For me some automatic folding options were done by the vim-pandoc plugin. Ingo's tip tip worked good when I created the file ~/.vim/after/ftplugin/pandoc.vim with his recommendations; however, the plugin reloaded at times and its folding settings returned. With the vim-pandoc plugin its own settings have to be used. I set the column width to 0 and opted to do folding on my own:

: let g:pandoc#folding#mode = ['manual']
: let g:pandoc#folding#fdc = 0
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top