AstroNvim / astrocommunity

A community repository of common plugin specifications
GNU General Public License v3.0
1.12k stars 228 forks source link

(v4)(heirline-nvchad-statusline) Statusline UI style varies between opening a dir and a file with `nvim` command #840

Closed BulaBula-zy closed 4 months ago

BulaBula-zy commented 4 months ago

Checklist

Neovim version (nvim -v)

v0.9.5 release

Operating system/version

macOS Sonoma 14.4.1

Terminal/GUI

wezTerm

Describe the bug

A few days ago, I started migrating AstroNvim from v3 to v4.

At first, I found that the statusline plugin heirline-mode-text-statusline that I used in v3 was officially removed in v4.

Then I found the replacement plugin heirline-nvchad-statusline and installed it with astrocommunity in v4. But then I got the following bug:

When I open a file using nvim command, the statusline UI style differs from when I open a dir using nvim command.

Steps to Reproduce

  1. Install AstroNvim
  2. Clone template repository to $HOME/.config/astronvim_v4
  3. Modify community.lua to install plugin heirline-nvchad-statusline
  4. Open a dir
    1. Input command nvim $HOME/.config/astronvim_v4 in wezTerm
    2. Select init.lua in the neo-tree
    3. Enter to open it
  5. Open a file
    1. Input command nvim $HOME/.config/astronvim_v4/init.lua in wezTerm

Expected behavior

The statusline UI style is expected to be consistent under both behaviors.

Specifically, the color of mode icon and text, lsp separator, folder icon and nav icon should be dark when I open a file using nvim command.

Screenshots

This is when I open a dir:

image.png

And this is when I open a file:

image.png

Additional Context

I'm not sure whether this is how this plugin heirline-nvchad-statusline was originally designed, so that there are different statusline UI styles for opening file and dir with nvim command, OR it is indeed a bug.

Just in case, here's my config file and plugin version:

-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE

-- AstroUI provides the basis for configuring the AstroNvim User Interface
-- Configuration documentation can be found with `:h astroui`
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
--       as this provides autocomplete and documentation while editing

---@type LazySpec
return {
  "AstroNvim/astroui",
  ---@type AstroUIOpts
  opts = {
    -- change colorscheme
    -- colorscheme = "astrodark",
    -- colorscheme = "catppuccin-frappe",
    colorscheme = "catppuccin-mocha",
    -- colorscheme = "tokyonight", -- tokyonight-storm default

    -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes
    highlights = {
      init = { -- this table overrides highlights in all themes
        -- Normal = { bg = "#000000" },
      },
      astrotheme = { -- a table of overrides/changes when applying the astrotheme theme
        -- Normal = { bg = "#000000" },
      },
    },
    -- Icons can be configured throughout the interface
    icons = {
      -- configure the loading of the lsp in the status line
      LSPLoading1 = "⠋",
      LSPLoading2 = "⠙",
      LSPLoading3 = "⠹",
      LSPLoading4 = "⠸",
      LSPLoading5 = "⠼",
      LSPLoading6 = "⠴",
      LSPLoading7 = "⠦",
      LSPLoading8 = "⠧",
      LSPLoading9 = "⠇",
      LSPLoading10 = "⠏",
    },
  },
}
-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE

-- AstroCommunity: import any community modules here
-- We import this file in `lazy_setup.lua` before the `plugins/` folder.
-- This guarantees that the specs are processed before any user plugins.

---@type LazySpec
return {
  "AstroNvim/astrocommunity",
  { import = "astrocommunity.colorscheme.catppuccin" },
  { import = "astrocommunity.colorscheme.tokyonight-nvim" },
  { import = "astrocommunity.color.transparent-nvim" },
  { import = "astrocommunity.editing-support.vim-move" },
  { import = "astrocommunity.editing-support.rainbow-delimiters-nvim" },
  { import = "astrocommunity.motion.nvim-surround" },
  { import = "astrocommunity.pack.lua" },
  { import = "astrocommunity.pack.go" },
  { import = "astrocommunity.pack.python-ruff" },
  { import = "astrocommunity.pack.cpp" },
  { import = "astrocommunity.pack.cmake" },
  { import = "astrocommunity.pack.json" },
  { import = "astrocommunity.pack.java" },
  { import = "astrocommunity.pack.markdown" },
  { import = "astrocommunity.pack.rust" },
  { import = "astrocommunity.pack.yaml" },
  { import = "astrocommunity.pack.toml" },
  { import = "astrocommunity.pack.html-css" },
  { import = "astrocommunity.pack.typescript-all-in-one" },
  { import = "astrocommunity.pack.vue" },
  { import = "astrocommunity.pack.ansible" },
  { import = "astrocommunity.pack.docker" },
  { import = "astrocommunity.pack.bash" },
  { import = "astrocommunity.register.nvim-neoclip-lua" },
  { import = "astrocommunity.recipes.heirline-nvchad-statusline" },
  -- import/override with your plugins folder
}
Uzaaft commented 4 months ago

I believe this is an issue with your colorscheme more than an isue with the heirline-nvchad-statusline.

Uzaaft commented 4 months ago

Opening a dir on top vs a file directly below:

image
Uzaaft commented 4 months ago

We can continue the discussion here, but closing this issue since it seems to me to be an issue with your config(a combination of astrocom plugins) more than an issue with the nvchad spec.

BulaBula-zy commented 4 months ago

I found the issue may be caused by this plugin transparent.

After I deleted transparent, everything went fine.

I guess that heirline-nvchad-statusline(or astronui) uses the bg color of statusline as the mode icon and text, lsp separator, folder icon and nav icon color. So when statusline becomes transparent, the components above will change color as well.

Looking closely, I can see the bg color of the statusline is not same when opening a file and dir (both transparent keep on).

image.png

image.png

So the issue seems to be why transparent would have different UI behavior for opening a file and opening a dir. I'll probably look for some answers from there later. Anyway, I just choose to remove transparent for now.