From aa418a2147f52fbe3225aced3a0e7638cf15ea78 Mon Sep 17 00:00:00 2001 From: Michael Olson <48652773+m0lson84@users.noreply.github.com> Date: Sun, 7 Jul 2024 13:28:51 -0400 Subject: [PATCH] feat(icons): provide language specific icons in extras (#3931) ## What is this PR for? Provide language specific file icons. The intent is to lay the foundation of this type of extension / configuration. I've added icons for file types that I interact with but this is definitely not holistic. I also went back and forth on whether the configuration should be within the core UI config or in the extras (I landed on the later). Definitely open to feedback on these changes. ## Does this PR fix an existing issue? Nope. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/lang/go.lua | 13 ++++++++++++ .../plugins/extras/lang/typescript.lua | 18 +++++++++++++++++ lua/lazyvim/plugins/extras/util/chezmoi.lua | 20 +++++++++++++++++++ lua/lazyvim/plugins/ui.lua | 11 +++++++++- 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 931f8df4..b9544cfd 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -137,4 +137,17 @@ return { }, }, }, + + -- Filetype icons + { + "echasnovski/mini.icons", + opts = { + file = { + [".go-version"] = { glyph = "", hl = "MiniIconsBlue" }, + }, + filetype = { + gotmpl = { glyph = "󰟓", hl = "MiniIconsGrey" }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 139c3086..71ec4604 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -248,4 +248,22 @@ return { end end, }, + + -- Filetype icons + { + "echasnovski/mini.icons", + opts = { + file = { + [".eslintrc.js"] = { glyph = "󰱺", hl = "MiniIconsYellow" }, + [".node-version"] = { glyph = "", hl = "MiniIconsGreen" }, + [".prettierrc"] = { glyph = "", hl = "MiniIconsPurple" }, + [".yarnrc.yml"] = { glyph = "", hl = "MiniIconsBlue" }, + ["eslint.config.js"] = { glyph = "󰱺", hl = "MiniIconsYellow" }, + ["package.json"] = { glyph = "", hl = "MiniIconsGreen" }, + ["tsconfig.json"] = { glyph = "", hl = "MiniIconsAzure" }, + ["tsconfig.build.json"] = { glyph = "", hl = "MiniIconsAzure" }, + ["yarn.lock"] = { glyph = "", hl = "MiniIconsBlue" }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index 56518dfd..633f3008 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -88,4 +88,24 @@ return { table.insert(opts.config.center, 5, projects) end, }, + + -- Filetype icons + { + "echasnovski/mini.icons", + opts = { + file = { + [".chezmoiignore"] = { glyph = "", hl = "MiniIconsGrey" }, + [".chezmoiremove"] = { glyph = "", hl = "MiniIconsGrey" }, + [".chezmoiroot"] = { glyph = "", hl = "MiniIconsGrey" }, + [".chezmoiversion"] = { glyph = "", hl = "MiniIconsGrey" }, + ["bash.tmpl"] = { glyph = "", hl = "MiniIconsGrey" }, + ["json.tmpl"] = { glyph = "", hl = "MiniIconsGrey" }, + ["ps1.tmpl"] = { glyph = "󰨊", hl = "MiniIconsGrey" }, + ["sh.tmpl"] = { glyph = "", hl = "MiniIconsGrey" }, + ["toml.tmpl"] = { glyph = "", hl = "MiniIconsGrey" }, + ["yaml.tmpl"] = { glyph = "", hl = "MiniIconsGrey" }, + ["zsh.tmpl"] = { glyph = "", hl = "MiniIconsGrey" }, + }, + }, + }, } diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 5fde7ebd..97c35ae9 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -306,7 +306,16 @@ return { { "echasnovski/mini.icons", lazy = true, - opts = {}, + opts = { + file = { + [".keep"] = { glyph = "󰊢", hl = "MiniIconsGrey" }, + ["CODEOWNERS"] = { glyph = "", hl = "MiniIconsGreen" }, + ["devcontainer.json"] = { glyph = "", hl = "MiniIconsAzure" }, + }, + filetype = { + dotenv = { glyph = "", hl = "MiniIconsYellow" }, + }, + }, init = function() package.preload["nvim-web-devicons"] = function() require("mini.icons").mock_nvim_web_devicons()