vimtricks.wiki Concise Vim tricks, one at a time.

How do I hide or replace the ~ characters that appear at the end of a buffer?

Answer

:set fillchars+=eob:

Explanation

By default, Vim fills empty lines after the end of a buffer with ~ characters. While these mark where the file ends, many users find them visually distracting. The fillchars option lets you replace them with any character — including a plain space to make them invisible.

How it works

  • fillchars controls characters used for various UI elements: eob (end of buffer), fold, diff, vert (vertical split), and others.
  • eob: sets the end-of-buffer fill character to a space, effectively hiding the ~ markers.
  • The += syntax appends to the existing value rather than replacing all fill characters.
  • This setting is purely cosmetic — Vim still knows where the file ends.

Example

Before:

  1 Last line of file
  2 ~
  3 ~
  4 ~

After :set fillchars+=eob: :

  1 Last line of file
  2  
  3  
  4  

Tips

  • Use a Unicode character to replace ~ with something subtle instead of hiding it:
set fillchars+=eob
  • Customize multiple fill characters at once:
set fillchars=eob: ,fold:·,vert:│
  • fold replaces the dashes (------) on folded lines; vert replaces the | on vertical split separators for a cleaner look with Nerd Font box-drawing characters.

Next

How do I change the working directory to the folder containing the current file without affecting other windows?