How do I use Vim's built-in file explorer netrw to browse and manage files?
Answer
:Explore
Explanation
Netrw is Vim's built-in file explorer plugin that comes with every Vim installation. The :Explore command opens a directory listing in the current window where you can browse, open, create, rename, and delete files without leaving Vim.
How it works
:Explore(or:Ex) opens the file explorer in the current window- Navigate directories with
<CR>to enter,-to go up - Press
<CR>on a file to open it - The explorer shows file sizes, dates, and permissions
Example
Useful netrw commands within the explorer:
<CR> - Open file or directory
- - Go to parent directory
% - Create a new file
d - Create a new directory
D - Delete file or directory
R - Rename file
i - Cycle through view styles (thin/long/wide/tree)
Tips
:Sexploreopens in a horizontal split,:Vexplorein a vertical splitlet g:netrw_liststyle = 3sets tree view as defaultlet g:netrw_banner = 0hides the help banner:Lexploreopens a persistent sidebar explorer- Netrw can also browse remote files:
:Explore scp://host/path/