How do I open a file explorer in a vertical split without any plugins?
Answer
:Vexplore
Explanation
Vim ships with netrw, a built-in file explorer that requires no plugins. The :Vexplore command opens the explorer in a vertical split to the left, giving you a sidebar-style file browser while keeping your current file visible.
How it works
:Vexploreopens netrw in a vertical split on the left- Navigate with
j/kand press<CR>to open a file - The file opens in the adjacent window, replacing the previous buffer
- Press
-to go up one directory
Example
Starting with a single file open:
+-------------------------+
| your_file.py |
+-------------------------+
After :Vexplore:
+-----------+-------------+
| netrw | your_file.py|
| ../ | |
| src/ | |
| README.md | |
+-----------+-------------+
Tips
:Hexploreopens the explorer in a horizontal split below:Sexploreopens in a horizontal split above:Exploreopens the explorer in the current window- Set
let g:netrw_winsize = 25in your vimrc for a 25% width sidebar - Press
iin netrw to cycle through listing styles (thin, long, wide, tree) - Press
%in netrw to create a new file