Merge branch 'NikolaM-Dev-feature-custom-icons'

This commit is contained in:
Steven Arcangeli 2023-04-11 08:29:23 -07:00
commit fb8b101d7c
3 changed files with 13 additions and 5 deletions

6
.github/generate.py vendored
View file

@ -100,7 +100,11 @@ COL_DEFS = [
"*", "*",
False, False,
"An icon for the entry's type (requires nvim-web-devicons)", "An icon for the entry's type (requires nvim-web-devicons)",
HL + [], HL
+ [
LuaParam("default_file", "string", "Fallback icon for files when nvim-web-devicons returns nil"),
LuaParam("directory", "string", "Icon for directories"),
],
), ),
ColumnDef("size", "files, ssh", False, "The size of the file", HL + []), ColumnDef("size", "files, ssh", False, "The size of the file", HL + []),
ColumnDef( ColumnDef(

View file

@ -232,8 +232,11 @@ icon *column-ico
An icon for the entry's type (requires nvim-web-devicons) An icon for the entry's type (requires nvim-web-devicons)
Parameters: Parameters:
{highlight} `string|fun(value: string): string` Highlight group, or {highlight} `string|fun(value: string): string` Highlight group, or
function that returns a highlight group function that returns a highlight group
{default_file} `string` Fallback icon for files when nvim-web-devicons
returns nil
{directory} `string` Icon for directories
size *column-size* size *column-size*
Adapters: files, ssh Adapters: files, ssh

View file

@ -205,12 +205,13 @@ if has_devicons then
end end
end end
if type == "directory" then if type == "directory" then
return { "", "OilDir" } local icon = conf and conf.directory or ""
return { icon, "OilDir" }
else else
local icon local icon
local hl local hl
icon, hl = devicons.get_icon(name) icon, hl = devicons.get_icon(name)
icon = icon or "" icon = icon or (conf and conf.default_file or "")
return { icon .. " ", hl } return { icon .. " ", hl }
end end
end, end,