1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

switch from nvim-web-devicons to mini.icons (#399)

This commit is contained in:
jdhao 2025-04-08 19:11:20 +02:00 committed by GitHub
parent 5826161160
commit aadfdae677
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 62 additions and 51 deletions

View File

@ -1,4 +1,7 @@
require("fzf-lua").setup { require("fzf-lua").setup {
defaults = {
file_icons = "mini",
},
winopts = { winopts = {
row = 0.5, row = 0.5,
height = 0.7, height = 0.7,

View File

@ -1,6 +1,14 @@
-- Setup nvim-cmp. -- Setup nvim-cmp.
local cmp = require("cmp") local cmp = require("cmp")
local lspkind = require("lspkind")
-- The extentions needed by nvim-cmp should be loaded beforehand
require("cmp_nvim_lsp")
require("cmp_path")
require("cmp_buffer")
require("cmp_omni")
require("cmp_nvim_ultisnips")
local MiniIcons = require("mini.icons")
cmp.setup { cmp.setup {
snippet = { snippet = {
@ -43,21 +51,14 @@ cmp.setup {
view = { view = {
entries = "custom", entries = "custom",
}, },
-- solution taken from https://github.com/echasnovski/mini.nvim/issues/1007#issuecomment-2258929830
formatting = { formatting = {
format = lspkind.cmp_format { format = function(_, vim_item)
mode = "symbol_text", local icon, hl = MiniIcons.get("lsp", vim_item.kind)
menu = { vim_item.kind = icon .. " " .. vim_item.kind
nvim_lsp = "[LSP]", vim_item.kind_hl_group = hl
ultisnips = "[US]", return vim_item
path = "[Path]", end,
buffer = "[Buffer]",
emoji = "[Emoji]",
omni = "[Omni]",
},
show_labelDetails = true,
maxwidth = 40,
ellipsis_char = "...",
},
}, },
} }

View File

@ -22,24 +22,19 @@ end
local plugin_specs = { local plugin_specs = {
-- auto-completion engine -- auto-completion engine
{ "hrsh7th/cmp-nvim-lsp", lazy = true },
{ "hrsh7th/cmp-path", lazy = true },
{ "hrsh7th/cmp-buffer", lazy = true },
{ "hrsh7th/cmp-omni", lazy = true },
{ "quangnguyen30192/cmp-nvim-ultisnips", lazy = true },
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
name = "nvim-cmp", name = "nvim-cmp",
-- event = 'InsertEnter', event = "InsertEnter",
event = "VeryLazy",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"onsails/lspkind-nvim",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-omni",
"quangnguyen30192/cmp-nvim-ultisnips",
},
config = function() config = function()
require("config.nvim-cmp") require("config.nvim-cmp")
end, end,
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
event = { "BufRead", "BufNewFile" }, event = { "BufRead", "BufNewFile" },
@ -56,7 +51,7 @@ local plugin_specs = {
}, },
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
event = "VeryLazy", lazy = true,
build = ":TSUpdate", build = ":TSUpdate",
config = function() config = function()
require("config.treesitter") require("config.treesitter")
@ -88,7 +83,7 @@ local plugin_specs = {
-- Super fast buffer jump -- Super fast buffer jump
{ {
"smoka7/hop.nvim", "smoka7/hop.nvim",
event = "VeryLazy", keys = { "f" },
config = function() config = function()
require("config.nvim_hop") require("config.nvim_hop")
end, end,
@ -112,8 +107,6 @@ local plugin_specs = {
}, },
{ {
"ibhagwan/fzf-lua", "ibhagwan/fzf-lua",
-- optional for icon support
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
require("config.fzf-lua") require("config.fzf-lua")
end, end,
@ -122,7 +115,6 @@ local plugin_specs = {
"MeanderingProgrammer/markdown.nvim", "MeanderingProgrammer/markdown.nvim",
main = "render-markdown", main = "render-markdown",
opts = {}, opts = {},
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
}, },
-- A list of colorscheme plugin you may want to try. Find what suits you. -- A list of colorscheme plugin you may want to try. Find what suits you.
{ "navarasu/onedark.nvim", lazy = true }, { "navarasu/onedark.nvim", lazy = true },
@ -141,7 +133,18 @@ local plugin_specs = {
branch = "v2", branch = "v2",
}, },
{ "rebelot/kanagawa.nvim", lazy = true }, { "rebelot/kanagawa.nvim", lazy = true },
{ "nvim-tree/nvim-web-devicons", event = "VeryLazy" },
-- plugins to provide nerdfont icons
{
"echasnovski/mini.icons",
version = false,
config = function()
-- this is the compatibility fix for plugins that only support nvim-web-devicons
require("mini.icons").mock_nvim_web_devicons()
require("mini.icons").tweak_lsp_kind()
end,
lazy = true,
},
{ {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
@ -171,11 +174,16 @@ local plugin_specs = {
}, },
{ {
"lukas-reineke/indent-blankline.nvim", "echasnovski/mini.indentscope",
event = "VeryLazy", version = false,
main = "ibl",
config = function() config = function()
require("config.indent-blankline") local mini_indent = require("mini.indentscope")
mini_indent.setup {
draw = {
animation = mini_indent.gen_animation.none(),
},
symbol = "",
}
end, end,
}, },
{ {
@ -201,7 +209,7 @@ local plugin_specs = {
end, end,
}, },
-- Highlight URLs inside vim -- Highlight URLs inside vim
{ "itchyny/vim-highlighturl", event = "VeryLazy" }, { "itchyny/vim-highlighturl", event = "BufReadPost" },
-- notification plugin -- notification plugin
{ {
@ -212,6 +220,8 @@ local plugin_specs = {
end, end,
}, },
{ "nvim-lua/plenary.nvim", lazy = true },
-- For Windows and Mac, we can open an URL in the browser. For Linux, it may -- For Windows and Mac, we can open an URL in the browser. For Linux, it may
-- not be possible since we maybe in a server which disables GUI. -- not be possible since we maybe in a server which disables GUI.
{ {
@ -224,7 +234,6 @@ local plugin_specs = {
enabled = function() enabled = function()
return vim.g.is_win or vim.g.is_mac return vim.g.is_win or vim.g.is_mac
end, end,
dependencies = { "nvim-lua/plenary.nvim" },
config = true, -- default settings config = true, -- default settings
submodules = false, -- not needed, submodules are required only for tests submodules = false, -- not needed, submodules are required only for tests
}, },
@ -252,7 +261,10 @@ local plugin_specs = {
}, },
-- Comment plugin -- Comment plugin
{ "tpope/vim-commentary", event = "VeryLazy" }, { "tpope/vim-commentary", keys = {
{ "gc", mode = "n" },
{ "gc", mode = "v" },
} },
-- Multiple cursor plugin like Sublime Text? -- Multiple cursor plugin like Sublime Text?
-- 'mg979/vim-visual-multi' -- 'mg979/vim-visual-multi'
@ -266,7 +278,7 @@ local plugin_specs = {
config = function() config = function()
require("config.yanky") require("config.yanky")
end, end,
event = "VeryLazy", cmd = "YankyRingHistory",
}, },
-- Handy unix command inside Vim (Rename, Move etc.) -- Handy unix command inside Vim (Rename, Move etc.)
@ -360,7 +372,7 @@ local plugin_specs = {
ft = { "markdown" }, ft = { "markdown" },
}, },
{ "chrisbra/unicode.vim", event = "VeryLazy" }, { "chrisbra/unicode.vim", keys = { "ga" }, cmd = { "UnicodeSearch" } },
-- Additional powerful text object for vim, this plugin should be studied -- Additional powerful text object for vim, this plugin should be studied
-- carefully to use its full power -- carefully to use its full power
@ -369,9 +381,6 @@ local plugin_specs = {
-- Plugin to manipulate character pairs quickly -- Plugin to manipulate character pairs quickly
{ "machakann/vim-sandwich", event = "VeryLazy" }, { "machakann/vim-sandwich", event = "VeryLazy" },
-- Add indent object for vim (useful for languages like Python)
{ "michaeljsmith/vim-indent-object", event = "VeryLazy" },
-- Only use these plugin on Windows and Mac and when LaTeX is installed -- Only use these plugin on Windows and Mac and when LaTeX is installed
{ {
"lervag/vimtex", "lervag/vimtex",
@ -481,8 +490,7 @@ local plugin_specs = {
-- file explorer -- file explorer
{ {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
event = "VeryLazy", keys = { "<space>s" },
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
require("config.nvim-tree") require("config.nvim-tree")
end, end,
@ -490,8 +498,7 @@ local plugin_specs = {
{ {
"j-hui/fidget.nvim", "j-hui/fidget.nvim",
event = "VeryLazy", event = "BufRead",
tag = "legacy",
config = function() config = function()
require("config.fidget-nvim") require("config.fidget-nvim")
end, end,
@ -511,13 +518,12 @@ local plugin_specs = {
"CopilotC-Nvim/CopilotChat.nvim", "CopilotC-Nvim/CopilotChat.nvim",
dependencies = { dependencies = {
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim { "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
}, },
opts = { opts = {
debug = true, -- Enable debugging debug = true, -- Enable debugging
-- See Configuration section for rest -- See Configuration section for rest
}, },
-- See Commands section for default commands if you want to lazy load on them cmd = { "CopilotChat" },
}, },
{ {
"zbirenbaum/copilot.lua", "zbirenbaum/copilot.lua",
@ -534,7 +540,6 @@ local plugin_specs = {
config = function() config = function()
require("config.live-command") require("config.live-command")
end, end,
event = "VeryLazy",
}, },
{ {
-- show hint for code actions, the user can also implement code actions themselves, -- show hint for code actions, the user can also implement code actions themselves,
@ -543,9 +548,11 @@ local plugin_specs = {
config = function() config = function()
require("config.lightbulb") require("config.lightbulb")
end, end,
event = "VeryLazy",
}, },
{ {
"Bekaboo/dropbar.nvim", "Bekaboo/dropbar.nvim",
event = "VeryLazy",
}, },
{ {
"catgoose/nvim-colorizer.lua", "catgoose/nvim-colorizer.lua",