Neovim for Beginners — Window Bar using lualine.nvim

Configure the window bar using the lualine.nvim plugin.

alpha2phi

--

Neovim for Beginners — Window Bar using lualine.nvim

In an earlier article, we use the nvim-navic plugin, and the window bar to show the current code context.

We already use the lualine.nvim plugin in our existing configuration. In this article, we will explore using this plugin to configure the window bar.

This article is part of the Neovim for Beginners series.

The Neovim configuration files are available in this repository.

Configuration — lualine.nvim

In the config/lualine.lua file, we add the lines to configure the window bar.

  • We disable the window bar for certain file types (line 5 — line 21).
  • Using lualine.nvim, we can configure the window bar for the active and inactive windows (line 24 — line 39).
  • For the active window, we configure the window bar to display diagnostics information (line 25). This is an existing component provided by lualine.nvim.
  • We reuse the winbar component developed in the earlier article to display the current code context (line 28).
  • For the inactive window, we do not display the window bar.

Do check out the available components and how to develop custom components. lualine.nvim makes it extremely easy to customize the information we want to display in the window bar.

Existing Configuration

defaults.lua

In the after/plugin/defaults.lua file, we comment out the line to set the window bar option.

-- Change to use lualine.nvim
-- opt.winbar = "%{%v:lua.require'config.winbar'.get_winbar()%}"

winbar.lua

In the config/winbar.lua file, we comment the lines to check for file types to exclude (line 2 — line 5) since we already configure…

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.