Skip to content

AstroUI

AstroUI提供了 AstroNvim 的统一界面,例如图标、状态栏、winbar、tabline 等。

配置

在安装模版中它在lua/plugin/astroui.lua中被引入,因此配置也在这里进行。它的配置完全遵循lazy规范:

Lua
---@type AstroUIConfig
{
  -- 主题
  colorscheme = "astrodark",
  -- Override highlights in any colorscheme
  -- Keys can be:
  --   `init`: table of highlights to apply to all colorschemes
  --   `<colorscheme_name>` override highlights in the colorscheme with name: `<colorscheme_name>`
  highlights = {
    -- this table overrides highlights in all colorschemes
    init = {
      Normal = { bg = "#000000" },
    },
    -- a table of overrides/changes when applying astrotheme
    astrotheme = {
      Normal = { bg = "#000000" },
    },
  },
  -- A table of icons in the UI using NERD fonts
  -- icons 名称,他们能够在 AstroNvim 中使用
  icons = {
    GitAdd = "",
  },
  -- A table of only text "icons" used when icons are disabled
  -- 对应的非 Nerd fonts 的替代
  text_icons = {
    GitAdd = "[+]",
  },
  -- Configuration options for the AstroNvim lines and bars built with the `status` API.
  -- 状态栏设置, winbar
  status = {
    -- Configure attributes of components defined in the `status` API. Check the AstroNvim documentation for a complete list of color names, this applies to colors that have `_fg` and/or `_bg` names with the suffix removed (ex. `git_branch_fg` as attributes from `git_branch`).
    attributes = {
      git_branch = { bold = true },
    },
    -- Configure colors of components defined in the `status` API. Check the AstroNvim documentation for a complete list of color names.
    colors = {
      git_branch_fg = "#ABCDEF",
    },
    -- Configure which icons that are highlighted based on context
    icon_highlights = {
      -- enable or disable breadcrumb icon highlighting
      breadcrumbs = false,
      -- Enable or disable the highlighting of filetype icons both in the statusline and tabline
      file_icon = {
        tabline = function(self) return self.is_active or self.is_visible end,
        statusline = true,
      },
    },
    -- Configure characters used as separators for various elements
    separators = {
      none = { "", "" },
      left = { "", "  " },
      right = { "  ", "" },
      center = { "  ", "  " },
      tab = { "", "" },
      breadcrumbs = "  ",
      path = "  ",
    },
    -- Configure enabling/disabling of winbar
    winbar = {
      enabled = { -- whitelist buffer patterns
        filetype = { "gitsigns.blame" },
      },
      disabled = { -- blacklist buffer patterns
        buftype = { "nofile", "terminal" },
      },
    },
  },
}