nvim-web-devicons lazy load bugfix

main
bhagwan 3 years ago
parent 976ee88400
commit c76d6d9b36

@ -8,7 +8,15 @@ local actions = require "fzf-lua.actions"
local M = {}
M._has_devicons = pcall(require, "nvim-web-devicons")
M._has_devicons, M._devicons = pcall(require, "nvim-web-devicons")
-- if the caller has devicons lazy loaded
-- this will generate an error
-- nvim-web-devicons.lua:972: E5560:
-- nvim_command must not be called in a lua loop callback
if M._has_devicons and not M._devicons.has_loaded() then
M._devicons.setup()
end
M.win_height = 0.85
M.win_width = 0.80

@ -8,9 +8,9 @@ local M = {}
M.get_devicon = function(file, ext)
local icon = ''
if not file or #file == 0 then return icon end
if config._has_devicons then
local devicon = require'nvim-web-devicons'.get_icon(file, ext)
if not file or #file == 0 then return icon end
if config._has_devicons and config._devicons then
local devicon = config._devicons.get_icon(file, ext)
if devicon then icon = devicon end
end
return icon

Loading…
Cancel
Save