nvim-lua / kickstart.nvim

A launch point for your personal nvim configuration
MIT License
19.8k stars 23.81k forks source link

Which-Key rendering nerd-font icons when option set to false #1097

Closed Joaco-1321 closed 2 months ago

Joaco-1321 commented 2 months ago

Describe the bug

Which-Key showing nerd fonts regardless of the value of vim.g.have_nerd_font

image

image

To Reproduce

  1. Install Neovim as shown in the Ubuntu install recipe
  2. Install Kickstart
  3. Press space

Desktop

Neovim Version

NVIM v0.11.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Joaco-1321 commented 2 months ago

It seems that it also happens in Ubuntu, this is a fresh neovim install with only Kickstart

imagen

laajila commented 2 months ago

what worked for me :

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts (create folder if it doesn't exist)

3.) Run the command fc-cache -fv to manually rebuild the font cache

4) change this line in init.lua

vim.g.have_nerd_font = true
Joaco-1321 commented 2 months ago

what worked for me :

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts (create folder if it doesn't exist)

3.) Run the command fc-cache -fv to manually rebuild the font cache

4) change this line in init.lua

vim.g.have_nerd_font = true

Sorry I should clarify, I'm not using a nerd font and dont want to use one, but still renders like I have one

iton0 commented 2 months ago

I checked out the whichkey docs; try in your whichkey config opts.icons.mappings = vim.g.have_nerd_font. I will update #1068 to reference this issue.

Joaco-1321 commented 2 months ago

thanks @iton0, that solved part of the problem, but there's still some characters that doesn't get rendered.

I'm using Windows Terminal with Cascadia Code as font.

image

iton0 commented 2 months ago

Update the relevent key strings how you would like them to appear.

opts.icon.keys = {
      Up = " ",
      Down = " ",
      Left = " ",
      Right = " ",
      C = "󰘴 ",
      M = "󰘵 ",
      D = "󰘳 ",
      S = "󰘶 ",
      CR = "󰌑 ",
      Esc = "󱊷 ",
      ScrollWheelDown = "󱕐 ",
      ScrollWheelUp = "󱕑 ",
      NL = "󰌑 ",
      BS = "󰁮",
      Space = "󱁐 ",
      Tab = "󰌒 ",
      F1 = "󱊫",
      F2 = "󱊬",
      F3 = "󱊭",
      F4 = "󱊮",
      F5 = "󱊯",
      F6 = "󱊰",
      F7 = "󱊱",
      F8 = "󱊲",
      F9 = "󱊳",
      F10 = "󱊴",
      F11 = "󱊵",
      F12 = "󱊶",
    },
Joaco-1321 commented 2 months ago

again, thanks a lot @iton0, I should've read the docs first. do you know why they changed it? I remember when space was just <space>. and also, do I have to manually set all of these or is there a way to disable it? I will look the docs just in case but please let me know if you have an answer.

should I close this issue?

Joaco-1321 commented 2 months ago

also, keep up the good work man, I've seen you in various issues fixing things, your help it's very appreciated 😁

iton0 commented 2 months ago

@Joaco-1321 thank you! Keep this issue open for now. From the docs it seems like you have to do this manually but if you find otherwise please put the solution in here.

Additionally, I would ask in the which-key discussion for more info about the icons.

Joaco-1321 commented 2 months ago

thanks, this is what I've come up with if anyone that sees this issue is interested.

boring but simple.

image

iton0 commented 2 months ago

could you actually put that in a code block?

Joaco-1321 commented 2 months ago

oh sure, here it is.

require('which-key').setup {
  icons = {
    mappings = vim.g.have_nerd_font,
    keys = {
      Up = '<Up> ',
      Down = '<Down> ',
      Left = '<Left> ',
      Right = '<Right> ',
      C = '<C-…> ',
      M = '<M-…> ',
      D = '<D-…> ',
      S = '<S-…> ',
      CR = '<CR> ',
      Esc = '<Esc> ',
      ScrollWheelDown = '<ScrollWheelDown> ',
      ScrollWheelUp = '<ScrollWheelUp> ',
      NL = '<NL> ',
      BS = '<BS> ',
      Space = '<Space> ',
      Tab = '<Tab> ',
      F1 = '<F1>',
      F2 = '<F2>',
      F3 = '<F3>',
      F4 = '<F4>',
      F5 = '<F5>',
      F6 = '<F6>',
      F7 = '<F7>',
      F8 = '<F8>',
      F9 = '<F9>',
      F10 = '<F10>',
      F11 = '<F11>',
      F12 = '<F12>',
    },
  },
}