fix: filetype icon not updating with file change (#119)

This commit is contained in:
Shadman 2021-02-28 00:31:18 +06:00 committed by GitHub
parent ed7d186987
commit d019c04afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -6,12 +6,12 @@ local function filetype(options)
local data = vim.bo.filetype local data = vim.bo.filetype
if #data > 0 then if #data > 0 then
local ok, devicons = pcall(require,'nvim-web-devicons') local ok, devicons = pcall(require,'nvim-web-devicons')
if ok and not options.icon then if ok then
local f_name,f_extension = vim.fn.expand('%:t'),vim.fn.expand('%:e') local f_name,f_extension = vim.fn.expand('%:t'),vim.fn.expand('%:e')
options.icon = devicons.get_icon(f_name,f_extension) options.icon = devicons.get_icon(f_name,f_extension)
else else
ok = vim.fn.exists("*WebDevIconsGetFileTypeSymbol") ok = vim.fn.exists("*WebDevIconsGetFileTypeSymbol")
if ok ~= 0 and not options.icon then if ok ~= 0 then
options.icon = vim.fn.WebDevIconsGetFileTypeSymbol() options.icon = vim.fn.WebDevIconsGetFileTypeSymbol()
end end
end end