add error handling in statusline for devicons plugin
This commit is contained in:
parent
39a7f60682
commit
d9263b3718
1 changed files with 7 additions and 1 deletions
|
@ -71,7 +71,13 @@ M.fileInfo = function()
|
||||||
filename = " " .. filename .. " "
|
filename = " " .. filename .. " "
|
||||||
end
|
end
|
||||||
|
|
||||||
local ft_icon = require("nvim-web-devicons").get_icon(filename, extension)
|
local devicons_present, devicons = pcall(require, "nvim-web-devicons")
|
||||||
|
|
||||||
|
if not devicons_present then
|
||||||
|
return " "
|
||||||
|
end
|
||||||
|
|
||||||
|
local ft_icon = devicons.get_icon(filename, extension)
|
||||||
icon = (ft_icon ~= nil and " " .. ft_icon) or icon
|
icon = (ft_icon ~= nil and " " .. ft_icon) or icon
|
||||||
|
|
||||||
return "%#St_file_info#" .. icon .. filename .. "%#St_file_sep#" .. sep_r
|
return "%#St_file_info#" .. icon .. filename .. "%#St_file_sep#" .. sep_r
|
||||||
|
|
Loading…
Reference in a new issue