How do I browse directories as plain text buffers using vim-dirvish?
Answer
:Dirvish {path}
Explanation
vim-dirvish (by Justin M. Keyes) is a minimalist directory viewer for Vim. It opens a directory listing as a plain text buffer — every file path is an ordinary line you can search, filter, yank, and operate on with all your normal Vim tools. No tree widget, no special modes: just text.
How it works
:Dirvish— open the directory of the current file:Dirvish {path}— open a specific directory<CR>on a file — open it in the current window<CR>on a directory — enter it (reload the listing)-— go up to the parent directory (same key as vim-vinegar)q— close the dirvish buffer- Since the buffer is plain text, you can:
/patternto search for a filedGto delete all lines and show only yanked results!commandto shell-filter the listing
Install with: Plug 'justinmk/vim-dirvish'
Example
Open the current file's directory:
:Dirvish
Filter to show only Python files using Vim's built-in tools:
:Dirvish
:g!/\.py$/d
Now only .py files are listed. Press <CR> to open any of them.
Tips
:Dirvishintegrates withnetrw-aware plugins — it replaces netrw for directory browsing while keepinggx,gf, and remote file support- Use
Rto reload the listing if the directory changed on disk - The vim-dirvish-git companion plugin adds git status indicators to the listing
- Unlike NERDTree or nvim-tree, dirvish uses zero special syntax — your existing text motion skills transfer completely
:set splitright | vsplit | Dirvishopens a directory panel in a vertical split — a lightweight sidebar alternative