dired is a file manager in Emacs with the killer ability to list files as an editable text document, letting you rename, move and delete the files by manipulating that text (hence why itโ€™s called directory editor).

I sorely missed that functionality moving from Emacs to Neovim, until I found oil.nvim. Oil replaces the default netrw file explorer in Neovim with itself, and it replicates directory editing beautifully. Iโ€™ve even tested opening two Oil buffers and copying/moving lines from one to the other. It works exactly as expected.

See the video in the oil.nvim repo README for a demo.

After installing, simply run :Oil to open the current working directory as an Oil buffer. Make some edits and save the buffer to commit the changes.

Keymap Cheat Sheet

When inside an Oil buffer, these default keymappings are available. It helps to memorize at least some of them to make navigating directories a smoother experience.

  • g? Show a popup with this cheat sheet contents
  • <CR> Open the entry under the cursor
  • <C-p> Open the entry under the cursor in a preview window, or close the preview window if already open
  • <C-s> Open the entry under the cursor in a vertical split window
  • <C-h> Open the entry under the cursor in a horizontal split window
  • <C-t> Open the entry under the cursor in a new tab
  • <C-l> Refresh current directory list (:e! also works)
  • <C-c> Close Oil and restore original buffer
  • g. Toggle hidden files and directories (including the ../ parent entry)
  • g\ Jump to and from the trash for the current directory
  • - Navigate to the parent path
  • _ Open Oil at Neovimโ€™s current working directory
  • ` Runs :cd to change the current working directory to the current Oil directory
  • ~ Show the current working directory (cwd)
  • gx Open the entry under the cursor in an external program
  • gs Opens a popup that lets you change the sort order