Skip to content

Feat: A global option to set icons required by sections #1495

@ABDsheikho

Description

@ABDsheikho

Requested feature

To have a global option to set icons/symbols that are used by different sections.
The option should only provide the flexibility of changing an icon of a section
without the need to change/wrap it

Motivation

Some sections are honestly great, and don't need any tweaks.
But I do have a global variable for icons vim.g.my_icons which make it
easier for me to port my icons into other plugins.
Whereas with lualine I need to change every section to apply my icons.

Example

-- global for icons

vim.g.my_icons = {
  ...
  fileformat = {
    unix = '',
    dos = '󰨡',
    mac = '󰀷',
  },
  diagnostics = {
    error = '',
    warn = '',
    hint = '',
    info = '',
  },
  ...
}

Now I have to config each section even if they are completely fine and add them in order to implement it, .

-- within lualine config
...
    {
      'diagnostics',
      symbols = vim.g.my_icons.diagnostics,
    }
...
    {
      'fileformat',
      symbols = vim.g.my_icons.fileformat,
    }
...

Now this seems reasonable thing to do, and makes the config more declarative.
But I also need to apply each change within inactive_sections, tabline, winbar, etc.

Whereas having one global option would be similar to this:

    options = {
      -- new key
      -- NOTE: defining values here can be overwritten if they were also defined under their respective sections,
      -- having empty value means defaults are applied.
      icons = {
        -- each key is named after its section.
        fileformat = {}
        -- and follows the rules of its section.
        lsp_status = {
          icon = '',
          symbols = {
            spinner = { '', '', '', '', '', '', '', '', '', '' },
            done = '',
            separator = ' ',
          },
        }
      }
    }

Note

If you find this issue irrelevant, then it's OK to close it.
At the end a can apply everything I mentioned with your powerful plugin.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    new featureNew feature or feature request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions