Lualine for Neovim

Shaik Zahid
3 min readFeb 7, 2023

--

An amazing status line for Neovim

Lualine is a blazing fast and easy to configure Neovim statusline written in Lua. Unlike other statusline plugins, lualine loads only the components you specify, and nothing else. It’s goal is to provide a easy to customize and fast statusline.

Requirements

Installation

  1. Insertion of github repository should be done in plugins.lua file so that lualine gets installed in our IDE.
-- Plugins.lua file

return {

-- Bufferline
{
'akinsho/bufferline.nvim',
dependencies = 'nvim-tree/nvim-web-devicons'
},

-- Colorscheme
{
'folke/tokyonight.nvim',
},

-- Lualine (THE NEW EXTENSION ADDED IN CONFIGURATION)
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' }
},

-- Which-key
{
'folke/which-key.nvim',
lazy = true,
},

}

2. Save the file using Space + w and Invoke Lazy with Space + p to check the status of extension.

3. Install the plugin with Shift + i and move to configure lualine

Lazy after installing Lualine

Lualine Configuration

  • Create a new file lualine-config.lua in your lua directory.
  • Add this code in lualine-config.lua and source the file to main configuration.
-- Lualine Configuration 
-- This configuration is mainly implemented from their github repository.

require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

Source File to Main Config

  • Include lualine-config.lua file in init.lua using require keyword.
require "keymaps"
require "options"
require "lazy-config"
require "lualine-config" -- Added this line to initial file
require "bufferline-config"
require "whichkey"
  • Restart Neovim to load Lualine.
Neovim with Lualine and Bufferline.

Folder Structure

  • Added Lualine-config.lua to lua directory

Neovim From Scratch

  • If you want a complete installation and configuration of Neovim from Scratch, then you can head over to my NEOVIM SERIES.
  • This series is updated regularly, with updates and inclusion of newer plugins which improves the wholesome IDE experience of Neovim.

--

--