NvChad / starter

Starter config for NvChad
The Unlicense
66 stars 255 forks source link

UI - statusline modules `order` config doesn't work #16

Closed SPiCaRiA closed 3 months ago

SPiCaRiA commented 3 months ago

Hi, I'm trying to migrate my statusline settings from overriden_modules to the modules field as shown in the NvChad UI Configuration.

However when I tried to set the order of statusline modules, I simply got this error and not surprisingly it didn't work:

Screenshot 2024-04-01 at 16 40 43

My code:

  statusline = {
    -- Old
    -- overriden_modules = function(modules)
    --   -- Show column number in statusline
    --   table.insert(modules, 9, "%#St_ln_col#" .. " Ln %l, Col %c ")
    -- end,
    modules = {
      order = { "mode", "file", "git", "%=", "lsp_msg", "%=", "diagnostics", "lsp", "cursor_loc", "cwd", "cursor" },
      cursor_loc = function()
        return "%#St_ln_col#" .. " Ln %l, Col %c "
      end,
    },
  },

The doc and nvconfig.lua both implies that order is indeed an array though 🤔 :

...
  statusline = {
    -- more opts
    order = {...}, -- check stl/utils.lua file in ui repo 
    modules = {
      -- The default cursor module is override
      cursor = function()
        return "%#BruhHl#" .. " bruh " -- the highlight group here is BruhHl      end,
    }
  }
...

and nvconfig.lua:

...
  statusline = {
    theme = "default", -- default/vscode/vscode_colored/minimal
    -- default/round/block/arrow separators work only for default statusline theme
    -- round and block will work for minimal theme only
    separator_style = "default",
    order = nil,
    modules = nil,
  },

  tabufline = {
    enabled = true,
    lazyload = true,
    order = { "treeOffset", "buffers", "tabs", "btns" },
    modules = nil,
  },
...
SPiCaRiA commented 3 months ago

Btw there's a typo in the official doc, we lose the function end 🤣

      cursor = function()
        return "%#BruhHl#" .. " bruh " -- the highlight group here is BruhHl      end,
siduck commented 3 months ago

image

order is in root of statusline table, not inside modules

siduck commented 3 months ago

Btw there's a typo in the official doc, we lose the function end 🤣

      cursor = function()
        return "%#BruhHl#" .. " bruh " -- the highlight group here is BruhHl      end,

yea, but users must know at least basic lua to debug it xD

SPiCaRiA commented 3 months ago

image

order is in root of statusline table, not inside modules

Ah I missed that part for some reasons 🤣 Thank you so much