2

I am using neovim-qt for typescript react development. From last week I am configuring my neovim. I have configured coc.nvim which is giving pretty good autocompletion. I wanted to add icons for completion item kind. I did that setting suggest.completionItemKindLabels in CocConfig. The icons are showing fine. The only thing now I want is to add custom color to each icon. For now they are just showing same as the color of autocomplete text.

Is this something to do with colorscheme. I am using gruvbox.

  "suggest.completionItemKindLabels": {
    "variable": "\uf71b",
    "constant": "\uf8ff",
    "struct": "\ufb44",
    "class": "\uf0e8",
    "interface": "\ufa52",
    "text": "\ue612",
    "enum": "\uf435",
    "enumMember": "\uf02b",
    "color": "\ue22b",
    "property": "\ufab6",
    "field": "\uf93d",
    "unit": "\uf475",
    "file": "\uf471",
    "value": "\uf8a3",
    "event": "\ufacd",
    "folder": "\uf115",
    "keyword": "\uf893",
    "snippet": "\uf64d",
    "operator": "\uf915",
    "reference": "\uf87a",
    "typeParameter": "\uf278",
    "default": "\uf29c"
  }

For now icons are just showing as

enter image description here

Note: I am using webdevicons and also install nerd font on my system. The icons in explorer are colored but inside editor they are not.

1 Answer 1

-1

A suggestion: did you try ANSI colors?

Vim is a command line application and as so it uses ANSI colors to color every terminal column. So thus maybe you could color the icon that is going to be printed.

Here is a more complete doc about how to use ANSI colors: bash-colors.md.

You could try this line for example:
  "struct": "\033[31m\ufb44",
In theory it would print the icon with the color red.

I tried to test it before commenting here, but for me as for a lot of people coc.nvim is not showing icons. I'll figure it out with time.

Thx for the welcoming!

2
  • Thanks for writing an answer. To me, it sounds a little bit like a comment. Does this actually answer the question or was it only meant as a suggestion?
    – Friedrich
    Commented Oct 10, 2023 at 8:49
  • I'm not sure how ANSI colors are intended to solve this problem. Perhaps edit and clarify? Welcome to Vi and Vim!
    – D. Ben Knoble
    Commented Oct 10, 2023 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.