Neovim for Beginners — Buffer

How to manage buffers effectively, with and without plugins.

alpha2phi
6 min readJan 15, 2022
Neovim for Beginners — Buffer

Managing buffers, windows, and tabs is what we do daily as part of coding using Neovim. Let’s go through how to efficiently manage buffers, with and without plugins.

We are going to

  • Learn the basics of managing buffers and the related commands.
  • Develop a Lua-based module to select and jump to a buffer quickly.
  • Configure a Lua-based plugin to manage buffers.

This article is part of the Neovim for Beginners series.

The Neovim configuration files can be found in this repository.

The Basics

From Vim help (:h window),

A buffer is a file loaded into memory for editing. The original file remains
unchanged until you write the buffer to the file.

A window is a viewport onto a buffer. You can use multiple windows on one
buffer, or several windows on different buffers.

A tab page is a collection of windows.

A buffer has a unique number and can have 3 states — active, hidden, and inactive.

  • An active buffer means the buffer is displayed in a window, and the loaded file…

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.