From 23aca261e44da4152fed585388a9964840699708 Mon Sep 17 00:00:00 2001 From: glepnir Date: Tue, 25 Jun 2024 17:30:02 +0800 Subject: [PATCH] work with no web-devicons plugin --- lua/dashboard/theme/hyper.lua | 20 +++++++++++--------- lua/dashboard/utils.lua | 1 - 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lua/dashboard/theme/hyper.lua b/lua/dashboard/theme/hyper.lua index 4e09fae..00155b2 100644 --- a/lua/dashboard/theme/hyper.lua +++ b/lua/dashboard/theme/hyper.lua @@ -189,7 +189,7 @@ local function mru_list(config) for _, file in pairs(vim.list_slice(mlist, 1, config.mru.limit)) do local filename = vim.fn.fnamemodify(file, ':t') local icon, group = utils.get_icon(filename) - icon = icon or ' ' + icon = icon or '' if config.mru.cwd_only then file = vim.fn.fnamemodify(file, ':.') elseif not utils.is_win then @@ -405,14 +405,16 @@ local function gen_center(plist, config) for i, data in pairs(mgroups) do local len, group = unpack(data) - api.nvim_buf_add_highlight( - config.bufnr, - 0, - group, - first_line + i + plist_len, - start_col, - start_col + len - ) + if group then + api.nvim_buf_add_highlight( + config.bufnr, + 0, + group, + first_line + i + plist_len, + start_col, + start_col + len + ) + end api.nvim_buf_add_highlight( config.bufnr, 0, diff --git a/lua/dashboard/utils.lua b/lua/dashboard/utils.lua index da08bd6..9285ce5 100644 --- a/lua/dashboard/utils.lua +++ b/lua/dashboard/utils.lua @@ -64,7 +64,6 @@ end function utils.get_icon(filename) local ok, devicons = pcall(require, 'nvim-web-devicons') if not ok then - vim.notify('[dashboard.nvim] not found nvim-web-devicons') return nil end return devicons.get_icon(filename, nil, { default = true })