AstroNvim / astrocommunity

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

[Feature request]: Add unicode codepoint indicator to statusline #1042

Open osamuaoki opened 2 weeks ago

osamuaoki commented 2 weeks ago

Is your feature related to a problem?

Problem

These days, even English text data may contain hard to distinguish characters which may cause intriguing errors. For example:

Describe the new feature

Desirable feature

In addition to clock display recipe, add recipe for unicode code point display, e.g., [+2D]

Proposed solution

[N]vim's internal capability can be leveraged to create such a feature. For example, by adding equivalent of my user configuration.

  -- add unicode code point display to statusline
  {
    "rebelot/heirline.nvim",
    opts = function(_, opts)
      local status = require "astroui.status"
      -- add unicode codepoint indicator to last statusline indicator
      opts.statusline[#opts.statusline] = status.component.builder {
        provider = "[+U%02B]",
        hl = status.hl.get_attributes "mode", -- highlight based on mode attributes
        surround = { separator = "right", color = status.hl.mode_bg }, -- background highlight based on mode
      }
    end,
  },

Issue for me

I don't know how to add the above content to this package and make it discover-able from community.lua to create proper pull request to this package.

Additional context

FYI-1

I use to set statusline string in good old VIM as:

set statusline=%<%f%m%r%h%w%=%y%2l/%2L=%P,%2c%V\ [U+%02B]

FYI-2

The code above conflicts with the current clock recipe.