How do I toggle the display of hidden dot-files in Vim's built-in netrw file browser?
Answer
gh (in netrw)
Explanation
When browsing files with Vim's built-in netrw file explorer (:Explore or :Ex), hidden files starting with a dot (.gitignore, .env, etc.) are hidden by default. Press gh to toggle their visibility on or off without leaving the explorer.
How it works
gh— toggles thenetrw_hidesetting for the current netrw buffer, showing or hiding dotfiles- When dotfiles are shown, they appear alongside regular files in whatever listing style is active
- The toggle is per-session; it does not persist across Vim restarts unless you set
g:netrw_hide = 0in your config
Example
Open the file explorer with:
:Explore
You see only regular files. Press gh to reveal dotfiles:
.env
.gitignore
.nvimrc
README.md
src/
Press gh again to hide them.
Tips
- To show dotfiles by default, add
let g:netrw_hide = 0to your.vimrc g:netrw_list_hideaccepts a comma-separated list of patterns to hide — you can add your own (e.g.,*.pycfiles)- Other useful netrw toggles:
icycles through listing styles (thin, long, wide, tree),acycles through hide/show/all modes - See
:help netrw-ghfor full details