feat: config to remove icon padding (#145)
This commit is contained in:
parent
eaa20a6aee
commit
b24380c0e1
4 changed files with 18 additions and 5 deletions
1
.github/generate.py
vendored
1
.github/generate.py
vendored
|
|
@ -119,6 +119,7 @@ COL_DEFS = [
|
||||||
+ [
|
+ [
|
||||||
LuaParam("default_file", "string", "Fallback icon for files when nvim-web-devicons returns nil"),
|
LuaParam("default_file", "string", "Fallback icon for files when nvim-web-devicons returns nil"),
|
||||||
LuaParam("directory", "string", "Icon for directories"),
|
LuaParam("directory", "string", "Icon for directories"),
|
||||||
|
LuaParam("add_padding", "boolean", "Set to false to remove the extra whitespace after the icon"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ColumnDef("size", "files, ssh", False, "The size of the file", HL + []),
|
ColumnDef("size", "files, ssh", False, "The size of the file", HL + []),
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,8 @@ icon *column-ico
|
||||||
{default_file} `string` Fallback icon for files when nvim-web-devicons
|
{default_file} `string` Fallback icon for files when nvim-web-devicons
|
||||||
returns nil
|
returns nil
|
||||||
{directory} `string` Icon for directories
|
{directory} `string` Icon for directories
|
||||||
|
{add_padding} `boolean` Set to false to remove the extra whitespace after
|
||||||
|
the icon
|
||||||
|
|
||||||
size *column-size*
|
size *column-size*
|
||||||
Adapters: files, ssh
|
Adapters: files, ssh
|
||||||
|
|
@ -383,6 +385,9 @@ HIGHLIGHTS *oil-highlight
|
||||||
OilDir *hl-OilDir*
|
OilDir *hl-OilDir*
|
||||||
Directories in an oil buffer
|
Directories in an oil buffer
|
||||||
|
|
||||||
|
OilDirIcon *hl-OilDirIcon*
|
||||||
|
Icon for directories
|
||||||
|
|
||||||
OilSocket *hl-OilSocket*
|
OilSocket *hl-OilSocket*
|
||||||
Socket files in an oil buffer
|
Socket files in an oil buffer
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,16 +208,18 @@ if has_devicons then
|
||||||
type = meta.link_stat.type
|
type = meta.link_stat.type
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local icon, hl
|
||||||
if type == "directory" then
|
if type == "directory" then
|
||||||
local icon = conf and conf.directory or " "
|
icon = conf and conf.directory or ""
|
||||||
return { icon, "OilDir" }
|
hl = "OilDirIcon"
|
||||||
else
|
else
|
||||||
local icon
|
|
||||||
local hl
|
|
||||||
icon, hl = devicons.get_icon(name)
|
icon, hl = devicons.get_icon(name)
|
||||||
icon = icon or (conf and conf.default_file or "")
|
icon = icon or (conf and conf.default_file or "")
|
||||||
return { icon .. " ", hl }
|
|
||||||
end
|
end
|
||||||
|
if not conf or conf.add_padding ~= false then
|
||||||
|
icon = icon .. " "
|
||||||
|
end
|
||||||
|
return { icon, hl }
|
||||||
end,
|
end,
|
||||||
|
|
||||||
parse = function(line, conf)
|
parse = function(line, conf)
|
||||||
|
|
|
||||||
|
|
@ -625,6 +625,11 @@ M._get_highlights = function()
|
||||||
link = "Directory",
|
link = "Directory",
|
||||||
desc = "Directories in an oil buffer",
|
desc = "Directories in an oil buffer",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "OilDirIcon",
|
||||||
|
link = "OilDir",
|
||||||
|
desc = "Icon for directories",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name = "OilSocket",
|
name = "OilSocket",
|
||||||
link = "Keyword",
|
link = "Keyword",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue