Vim: Netrw
Netrw supports reading, writing, browsing, and managing files both locally and across a network. It comes packaged with Vim so it’s worth understanding the basics.
Using netrw
:Explore
opens netrw. If there are no unsaved changes netrw will
occupy the current window, otherwise a horizontal split will be created and
netrw will be displayed in the lower window. The directory listing of the
file that was being edited will be displayed,
There are other commands that also open netrw, but I rarely use them. Here are two options:
:Sexplore
open netrw in a horizontal split.:Vexplore
open netrw in a vertical split.
:Rexplore
either returns from netrw to the most recent file you were
editing or returns to netrw if you had selected a file to edit from
netrw. I think of it as return from/to explorer.
Netrw commands
i
toggles between display modes.
I
toggles displaying the directory banner.
gh
toggles listing hidden files.
j
and k
move down and up the directory listing.
<cr>
expand directory or open file. By default the file is opened in the netrw
window.
-
go up one directory level. You can also do this by moving to the ..
directory and pressing <cr>
.
%
create a file in the current directory.
d
create a directory in the current directory.
R
rename a file.
D
delete a file or empty directory.
There’s more
This is the basics of netrw
usage. It’s sufficient to get quite a lot done,
but there are a ton on netrw
features to help you be more productive. Start
with the help files to learn more.
Vim-vinegar Plugin
vim-vinegar provides a thin wrapper
around netrw
to enhance usability.
Resources
The best place to learn more is help itself:
:help netrw