Neovim 101 - File Management

Explore built-in file management features and plugins.

alpha2phi
5 min readDec 30, 2022

--

Neovim 101 — File Management

We explored the basics of the file explorer in the beginner series. This article explores lesser-known Neovim's built-in file management features. We will also check out plugins that help us manage files and folders more efficiently.

This article is part of the Neovim 101 series.

The Neovim configuration files are available in this repository.

Getting Started

In the previous article, we went through the basics of Netrw (:h netrw), configured sensible defaults for Netrw and installed the vinegar.vim plugin that enhances Netrw. We also installed and configured the nvim-tree Lua-based file explorer plugin for Neovim.

This article explores the lesser know features of Neovim for file handling.

File Editing

Automated Save

To automatically save the changes without asking, we can switch on the
autowriteall (:h awa) option. The default for this option is off.

With this option turned on, Neovim writes the contents of the file, if it has been modified,

  • on :next, :rewind, :last, :first, :previous, :stop, :suspend, :tag,:!, :make, CTRL-] and CTRL-^ command, and when a :buffer, CTRL-O, CTRL-I, ‘{A-Z0–9}, or `{A-Z0–9} command takes one to another file.
  • commands :edit, :enew, :quit, :qall, :exit, :xit, :recover and closing the Neovim window.

In the screenshot below, we cannot quit Neovim if the current buffer is not saved (without using !). Once we set the autowriteall option, the changes are saved automatically when we quit Neovim.

Neovim — autowriteall

Automated Directory Creation

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.