Neovim 101 — Window and Buffer

Explore the built-in window and buffer features, and plugins to help.

alpha2phi

--

Neovim 101 — Window and Buffer

In this article, we will get started with the new features of the Neovim window and buffer. We will also explore several interesting plugins that manipulate the window and buffer.

This article is part of the Neovim 101 series.

The Neovim configuration files are available in this repository.

Getting Started

Window

We assume you already have the minimum knowledge of managing windows. The Neovim user documentation (:h usr_08.txt) provides a very good introduction to managing windows, and the window command (:h CTRL-W) documentation lists all the supported commands.

usr_08.txt

Let’s go through several interesting features.

Global Status Line

Specifically for Neovim, we can set a global status line when we have several windows, using the laststatus option.

The value of this option influences when the last window will have a
status line.

  • 0 — never
  • 1 — only if there are at least two windows
  • 2 — always
  • 3 — always and ONLY the last window

In the screenshot below, when we set laststatus to 3, only 1 status line is displayed.

Global Status

We can also make the status line clickable using the %@ item.

For example, in the after/plugin/statusline.lua file, we trigger a Vimscript function when the file name is clicked.

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.