Scripts2026年7月28日·1 分钟阅读

lualine.nvim — Blazing Fast Statusline for Neovim

Statusline plugin written in pure Lua with themes and a component system for Neovim.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 66/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
lualine.nvim Overview
先审查命令
npx -y tokrepo@latest install 4ea8cc00-8a1c-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

lualine.nvim is a statusline plugin for Neovim written entirely in Lua. It provides a configurable, component-based statusline that displays information like mode, branch, diagnostics, filename, and file progress. The repository is nvim-lualine/lualine.nvim on GitHub with approximately 8,060 stars.

What lualine.nvim Does

lualine.nvim replaces Neovim's default statusline with a structured bar divided into sections (a, b, c, x, y, z). Each section holds components that display dynamic information—current mode, git branch, diff stats, LSP diagnostics, filetype, encoding, cursor position. The plugin also supports tabline and winbar rendering using the same component system.

Architecture Overview

The plugin organizes the statusline into six sections mirroring the vim-airline convention. Each section contains an ordered list of components. Built-in components cover common needs (mode, branch, diff, diagnostics, filename, progress), and users can define custom components as functions or tables. A theme engine applies color schemes to sections and mode transitions. The rendering pipeline evaluates components, applies formatting, and updates the statusline string on each relevant event.

Self-Hosting & Configuration

lualine.nvim runs locally inside Neovim. Install the plugin and optionally nvim-web-devicons for component icons. Configuration is done through require("lualine").setup({}) where you specify options for theme, section_separators, component_separators, and the component layout for each section. Themes can be selected from built-in options or defined as custom color tables.

Key Features

  • Component-based architecture with six configurable sections
  • Built-in components: mode, branch, diff, diagnostics, filename, filetype, progress, location
  • Theme system with many built-in themes (gruvbox, dracula, nord, auto, and more)
  • Custom components via functions, returning strings or tables
  • Section and component separators with customizable icons
  • Tabline and winbar support using the same configuration pattern
  • Conditional component display based on window width or custom conditions
  • Extensions for plugin integration (nvim-tree, fugitive, fzf, etc.)

Comparison with Similar Tools

Compared to vim-airline, lualine.nvim is Lua-native, loads faster, and avoids Vimscript overhead. galaxyline.nvim offers a provider-based approach with more granular control per segment but requires more configuration. heirline.nvim provides a lower-level statusline framework with full control over evaluation order, while lualine.nvim favors convention over configuration. feline.nvim is similar in concept but is no longer actively maintained, making lualine.nvim a more reliable choice.

FAQ

Q: How do I change the theme? A: Set options = { theme = "gruvbox" } in the setup call. Use "auto" to follow the current colorscheme automatically.

Q: Can I add custom components? A: Yes. Pass a function returning a string in any section's component list, e.g., lualine_c = { function() return os.date("%H:%M") end }.

Q: Does lualine support the winbar? A: Yes. Use the winbar and inactive_winbar keys in setup to configure per-window bars with the same component system.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产