Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically pad spaces to align icons of the same level #99

Open
Bekaboo opened this issue Nov 11, 2024 · 1 comment
Open

Automatically pad spaces to align icons of the same level #99

Bekaboo opened this issue Nov 11, 2024 · 1 comment
Labels
enhancement New feature or request up for grabs Good first issue & available for contributions

Comments

@Bekaboo
Copy link

Bekaboo commented Nov 11, 2024

Description

First of all thanks for making such an awesome plugin! From time to time I find myself prefer using pure ASCII text instead of nerd icons, but using the first character of kind names (as suggested in README.md) is not informative, so I use the abbreviations of kind names instead for the symbol icons. However, the abbreviations are variable-length, which makes the variable names misaligned, as shown in the screenshot below.

image

Could we pad the symbol icons in the outline window so that symbols on the same level are always aligned?

@Bekaboo Bekaboo added the enhancement New feature or request label Nov 11, 2024
@hedyhli
Copy link
Owner

hedyhli commented Nov 30, 2024

Hey, although this is a reasonable request, it's something that can be achieved through the config by padding spaces yourself:

symbols = {
  icons = {
    Function  = { icon = 'Func', hl = 'Function' },
    Variable  = { icon = 'Var ', hl = 'Constant' },
    Constant  = { icon = 'Con ', hl = 'Constant' },
    String    = { icon = 'Str ', hl = 'String' },
    Number    = { icon = 'Num ', hl = 'Number' },
    Boolean   = { icon = 'Bool', hl = 'Boolean' },
    ...
  }
}

In this example, we want all icons to have a width of 4 characters.

In fact, before I gave in and set up nerdicons in my terminal, I have used 4-character icons for both symbols and the Vim mode indicator (norm/ins /vis /VL ) and would pad them myself (I'm also not aware of a statusline plugin that automatically pads the mode indicator section, correct me if I'm wrong).

Sometimes I would want to update those text icons, such as switching to 2 characters instead. By aligning those strings we can easily use the Visual Block mode to bulk-edit the icon strings to insert and remove spaces :)

I'm happy to update the default config (in the readme) or accept PRs to align the keys of the symbols.icons field like in the example above.

@hedyhli hedyhli added the up for grabs Good first issue & available for contributions label Nov 30, 2024
@hedyhli hedyhli changed the title Align variable-length icons Automatically pad spaces to align icons of the same level Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request up for grabs Good first issue & available for contributions
Projects
None yet
Development

No branches or pull requests

2 participants