Check out my new project: Peer to Peer - watch how experts solve tech problems.

Learn more

Check out my new project: Peer to Peer - watch how experts solve tech problems.

The file explorer

#15

Run time:

This episode demonstrates how Vim’s native file browser can be used to explore and manipulate the file system.

Shownotes

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

Further Reading

Comments

Level-up your Vim

Training

Boost your productivity with a Vim training class. Join a public class, or book a private session for your team.

Drew hosted a private Vim session for the shopify team that was one of the best workshops I have ever attended.

John Duff, Director of Engineering at Shopify

Publications

Make yourself a faster and more efficient developer with the help of these publications, including Practical Vim (Pragmatic Bookshelf 2012), which has over 50 five-star reviews on Amazon.

After reading it, I've switched to vim as my default editor on a daily basis with no regrets. ★★★★★

Javier Collado

Learn to use Vim efficiently in your Ruby projects

In association with Thoughtbot, one of the most well respected Rails consultancies in the world, I've produced a series of screencasts on how to make navigating your Ruby projects with Vim ultra-efficient. Along the way, you’ll also learn how to make Ruby blocks a first-class text object in Vim. This lets you edit Ruby code at a higher level of abstraction. Available to buy from Thoughtbot..