Skip to content
TheChatArchiveThe Chat Archive
gpt-4o-2024-05-13· OpenAIAi2 WildChat-4.8M (AI2)

when i start vim . in current directory, i don't see dotfiles like .gitignore etc. how…

  1. User

    when i start vim . in current directory, i don't see dotfiles like .gitignore etc. how to show all hidden files?

  2. 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 .gitignore are shown in "netrw," you can modify its settings.

    Here's how you can display hidden files:

    1. Open Vim and then open the directory using :e . or :Explore (or any other netrw command you prefer).
    2. Press i while 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 vimrc configuration file (usually located at ~/.vimrc or ~/.config/nvim/init.vim for 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.