Filesystem Exploration


Vim provides a file manager plugin called netrw. Since netrw is shipped with Vim, it is present in any Vim installation including systems you remotely access occasionally. Its this omnipresence that makes it worth taking the time to learn. Not to mention, the plugin is incredibly comprehensive. My use of it scarcely scratches the surface of its capabilities. I generally use netrw to perform simple filesystem navigation as well as adding or removing files and directories. To enter netrw:

  • :Explore – explore the directory of the current file.
  • :e . – explore the current working directory of Vim.

Once inside netrw, the navigation experience is familiar. Keyboard motions like j and k and searching are supported. Here are some of the most common things I use in netrw:

  • % – create a file.
  • d – create a directory
  • D – remove a file or directory
  • R – rename a file or directory
  • x – open file in external program, like an image viewer.

The following screen capture shows a simple filesystem navigation and removal of a file.

For more information about netrw including neat features like editing files on remote systems, see :help netrw.

How useful was this tip?

Average rating 3.9 / 5. Vote count: 239

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Andy Libby

36 Posts

Rider of bicycles. Writer of code. User of Vim.
View all posts