vimfoldingtext-width

Setup Vim to cut fold line after 80 characters


In my .vimrc file I have textwidth=80 and a white line indicating 80 characters per line limit. Now, as I am also using folds, is there any way to cut fold lines to 80 characters.

Right now a fragment of C file in my setup looks like this:

enter image description here


Solution

  • The display of folded lines can be customized by the foldtext setting. In your case you likely want to restrict the width of the text so you would need to write a custom function that does this. As an example consider my CustomFoldText() function (simply specify a maximum width via the g:custom_foldtext_max_width variable.)