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
fillcharscontrols 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:│
foldreplaces the dashes (------) on folded lines;vertreplaces the|on vertical split separators for a cleaner look with Nerd Font box-drawing characters.