Skip to content

Commit

Permalink
fix(icons): replace most instances of core.icons with mini.icons
Browse files Browse the repository at this point in the history
Resolve: #58
  • Loading branch information
WilliamHsieh committed Nov 1, 2024
1 parent 71888ef commit cd0d65e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 137 deletions.
98 changes: 0 additions & 98 deletions config/nvim/lua/core/icons.lua

This file was deleted.

20 changes: 10 additions & 10 deletions config/nvim/lua/plugins/alpha.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
local M = {
"goolord/alpha-nvim",
priority = 500
priority = 500,
}

local function setup()
local dashboard = require "alpha.themes.dashboard"
local dashboard = require("alpha.themes.dashboard")

local function get_buttons()
local icons = require "core.icons"
local icons = require("mini.icons")
return {
dashboard.button("i", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert<CR>"),
dashboard.button("r", icons.ui.History .. " Recent files", ":FzfLua oldfiles<CR>"),
dashboard.button("p", icons.git.Repo .. " Find project", ":Telescope projects theme=dropdown<CR>"),
dashboard.button("s", icons.misc.Watch .. " Find session", ":SessionManager load_session<CR>"),
dashboard.button("l", icons.ui.Fire .. " Leetcode", ":Leet<CR>"),
dashboard.button("c", icons.ui.Gear .. " Config", ":e ~/dotfiles<CR>"),
dashboard.button("q", icons.diagnostics.Error .. " Quit", ":qa<CR>"),
dashboard.button("i", icons.get("default", "file") .. " New file", ":ene <BAR> startinsert<CR>"),
dashboard.button("r", " Recent files", ":FzfLua oldfiles<CR>"),
dashboard.button("p", icons.get("filetype", "git") .. " Find project", ":Telescope projects theme=dropdown<CR>"),
dashboard.button("s", icons.get("directory", ".git") .. " Find session", ":SessionManager load_session<CR>"),
dashboard.button("l", " Leetcode", ":Leet<CR>"),
dashboard.button("c", icons.get("filetype", "config") .. " Config", ":e ~/dotfiles<CR>"),
dashboard.button("q", " Quit", ":qa<CR>"),
}
end

Expand Down
10 changes: 6 additions & 4 deletions config/nvim/lua/plugins/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ function M.config()
},
sorting = sorting,
mapping = mappings,
---@diagnostic disable-next-line: missing-fields
formatting = {
format = function(_, vim_item)
vim_item.kind = string.format("%s %s", require("core.icons").kind[vim_item.kind], vim_item.kind)
vim_item.abbr = remove_leading_chr(vim_item.abbr)
return vim_item
format = function(_, item)
local icon = require("mini.icons").get("lsp", item.kind)
item.kind = string.format("%s %s", icon, item.kind)
item.abbr = remove_leading_chr(item.abbr)
return item
end,
},
sources = cmp.config.sources({
Expand Down
4 changes: 1 addition & 3 deletions config/nvim/lua/plugins/heirline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,11 @@ function M.config()
local Diagnostics = {
condition = conditions.has_diagnostics,
static = {
icons = require("core.icons").diagnostics
icons = { Error = "󰅙", Warning = "" },
},
init = function(self)
self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
self.hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
self.info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
end,
{
provider = function(self)
Expand Down
14 changes: 4 additions & 10 deletions config/nvim/lua/plugins/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,10 @@ function M.config()
require("plugins.lsp.utils").setup_auto_detach()

-- settings
local icons = require "core.icons"
local signs = {
{ name = "DiagnosticSignError", text = icons.diagnostics.Error },
{ name = "DiagnosticSignWarn", text = icons.diagnostics.Warning },
{ name = "DiagnosticSignHint", text = icons.diagnostics.Hint },
{ name = "DiagnosticSignInfo", text = icons.diagnostics.Information },
}

for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
local signs = { Error = "󰅙", Info = "󰋼", Hint = "󰌵", Warn = "" }
for name, icon in pairs(signs) do
local hl = "DiagnosticSign" .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
end

vim.diagnostic.config {
Expand Down
14 changes: 4 additions & 10 deletions config/nvim/lua/plugins/notify.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local M = {
{
"<C-L>",
function()
require("notify").dismiss({ silent = true, pending = true })
require("notify").dismiss { silent = true, pending = true }
---@diagnostic disable-next-line: param-type-mismatch
pcall(vim.cmd, "nohlsearch | diffupdate | mode")
end,
Expand All @@ -14,21 +14,15 @@ local M = {
}

function M.init()
---@diagnostic disable-next-line: duplicate-set-field
vim.notify = function(...)
local icons = require "core.icons"
vim.notify = require("notify")

---@diagnostic disable-next-line: missing-fields
vim.notify.setup {
stages = "fade_in_slide_out",
minimum_width = 10,
icons = {
ERROR = icons.diagnostics.Error,
WARN = icons.diagnostics.Warning,
INFO = icons.diagnostics.Information,
DEBUG = icons.ui.Bug,
TRACE = icons.ui.Pencil,
},
on_open = function (win)
on_open = function(win)
vim.api.nvim_win_set_config(win, { focusable = false })
end,
}
Expand Down
3 changes: 1 addition & 2 deletions config/nvim/lua/plugins/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ local M = {
function M.config()
local telescope = require("telescope")
local actions = require("telescope.actions")
local icons = require("core.icons")

telescope.setup {
defaults = {
Expand All @@ -18,7 +17,7 @@ function M.config()
".min.js",
},

prompt_prefix = icons.ui.Telescope .. " ",
prompt_prefix = " ",
selection_caret = "",
path_display = { "smart" },

Expand Down

0 comments on commit cd0d65e

Please sign in to comment.