Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8510199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:38:16+00:00 2026-06-11T03:38:16+00:00

I want my Vim to display empty lines as a string of ### characters,

  • 0

I want my Vim to display empty lines as a string of ### characters, like so:

Desired display of empty lines

I would like it to be work similarly to how I replace my tabs char to >--- with set listchars=tab:>-. Just display it that way, not actually insert them.

Also, it would be great if it could adapt to size of my terminal.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:38:17+00:00Added an answer on June 11, 2026 at 3:38 am

    The desired effect can be achieved via folding. If we create one-line
    folds separately containing empty lines of a buffer, they all will be
    marked out as folded. The only thing left will be to customize the
    highlighting accordingly.

    First of all, we need to automatically create the folds. For this
    purpose, we can switch folding to the expr method and then set
    the foldexpr option to evaluate to a non-zero value for empty
    lines only:

    :setl foldmethod=expr
    :setl foldexpr=empty(getline(v:lnum))
    

    What we should do next for the trick to work out is to make those
    folds close automatically in order to trigger the folding
    highlighting:

    :setl foldminlines=0
    :setl foldlevel=0
    :set foldclose=all
    

    Finally, to repeat a custom character in the folding line, we just
    empty the text displayed for a closed fold, and change the filling
    character:

    :setl foldtext=''
    :set fillchars+=fold:#
    

    Combining the above commands in one function for convenience,
    we obtain the following:

    function! FoldEmptyLine()
        setl foldmethod=expr
        setl foldexpr=empty(getline(v:lnum))
        setl foldminlines=0
        setl foldlevel=0
        set foldclose=all
        setl foldtext=''
        set fillchars+=fold:#
    endfunction
    

    The downside of this trick, of course, is that it interferes with the
    usual applications of folding, and cannot be easily used without
    modifications if the user extensively relies on folding for other
    purposes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want Vim 's completion menu to work more like the one in Visual
I want to understand how programs like vim or man work in a shell.
Often I want to search and replace in vim like this: :%s/<search_pattern>/<search_pattern>_foo/g Is there
I want open a path to vim from Screen's copy-mode by Ctrl-A f similarly
I want to unwrap text in Vim. When I join lines I get an
I want match spaces at the beginning of lines in Vim PseudoCode of what
I want to map a key in Vim such that i would hold down
In vim, I like using relative linenumbers to see how many lines I need
I want to use Vim's soft wrap capability ( :set wrap ) to wrap
I want to teach Vim how to open Perl 5 modules from names like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.