when i start vim . in current directory, i don't see dotfiles like .gitignore etc. how…
- User
when i start vim . in current directory, i don't see dotfiles like .gitignore etc. how to show all hidden files?
- Assistant
In Vim, hidden files (dotfiles) are typically included when you open a directory in "netrw," the built-in file explorer. To ensure that hidden files like
.gitignoreare shown in "netrw," you can modify its settings.Here's how you can display hidden files:
- Open Vim and then open the directory using
:e .or:Explore(or any other netrw command you prefer). - Press
iwhile in the netrw file browser. This will cycle through different views of the directory, including showing hidden files.
If you want to make this change permanent, you can add the following lines to your
vimrcconfiguration file (usually located at~/.vimrcor~/.config/nvim/init.vimfor Neovim):" Show hidden files in netrw let g:netrw_list_hide = '^\.\.\=/\=$' " Also, make sure to include hidden files in listing let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'After adding this to your
vimrc, hidden files should be displayed by default when using netrw.Alternatively, you can just configure netrw once inside Vim without saving it permanently by executing the commands:
:let g:netrw_liststyle=3 :let g:netrw_list_hide=''You can now open the directory using
:e .again and netrw will show hidden files as well. - Open Vim and then open the directory using