The video demonstrates some of the functionality of the netrw plugin, which is usually distributed with Vim. Note that if the NERD_tree is installed, then the functionality described in this episode won’t work for you.
Exploring the filesystem
The file explorer is just another Vim buffer, so you can navigate up and down with k
and j
keys, or jump to the bottom with G
, etc. If it is a large file listing, you may be quicker finding your target by searching for it.
There are a handful of useful commands for opening the file explorer - either in the current window or a split, focussing on the project root, or the directory of the most recent file edited. This table summarizes:
lazy | mnemonic | open file explorer |
---|---|---|
:e. |
:edit . |
at current working directory |
:sp. |
:split . |
in split at current working directory |
:vs. |
:vsplit . |
in vertical split at current working directory |
:E |
:Explore |
at directory of current file |
:Se |
:Sexplore |
in split at directory of current file |
:Vex |
:Vexplore |
in vertical split at directory of current file |
Manipulating the filesystem
The file explorer includes commands for creating new files and directories, as well as renaming or deleting existing ones. This table summarizes these:
command | action |
---|---|
% |
create a new file |
d |
create a new directory |
R |
rename the file/directory under the cursor |
D |
Delete the file/directory under the cursor |