Assuming that folding has been set up for your filetype (i.e. you can use keyboard commands like za
), you just need to enable the fold column with a specified width, e.g.:
:set foldcolumn=4
If you set this globally, it will always be there. If you only want to enable it for certain filetypes (that actually have folding), and/or adapt the width to the amount of nested folding, use :setlocal foldcolumn=...
instead, and put the corresponding commands into ~/.vim/after/ftplugin/<filetype>.vim
, where <filetype>
is the actual filetype (e.g. java
). (This requires that you have :filetype plugin on
.)
Alternatively, you could define an :autocmd FileType <filetype> setlocal foldcolumn=...
directly in your ~/.vimrc
, but this tends to become unwieldy once you have many customizations.