When I create a fold with zfap, vim displays something like:

+--  15 lines: myFunctionPrototype :: Test -> Test -> Bool 

However, I would like vim not to display this number of lines. I find this distracting, and not adding sufficient information in my case.

I'd prefer:

+-- : myFunctionPrototype :: Test -> Test -> Bool

or even better:

+-- myFunctionPrototype :: Test -> Test -> Bool

Is there a way to suppress the line count, or a way to modify what vim displays when there's a fold that I could put in my vimrc ?

2 Answers 2


to put in .vimrc:

set foldtext=MyFoldText()
function MyFoldText()
  let line = getline(v:foldstart)
  let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
  return v:folddashes . sub

MyFoldText is now the function that is responsible for displaying some text, when some lines have been folded.


The text that is displayed for a closed fold is determined by the 'foldtext' option. See

:help 'foldtext'
:help fold-foldtext

The latter topic has a few examples of ways to get different text. As another, simple example,

:set foldtext=v:folddashes

will result in a line of only dashes (actually hyphens) across the full width of the window.

  • not accros the full width of the window. I only have one dash at the start. but thanks, that's where I have to look at. Sep 5, 2015 at 18:25
  • Yes, across the full width of the window. Example: vim -N -u NONE -c "set foldtext=v:folddashes" -c "put=''" -c "normal ggzfG"
    – garyjohn
    Sep 6, 2015 at 5:34

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.