doc: explain passing parameters to columns
This commit is contained in:
parent
d8a1e7ca4e
commit
adb2828c4f
2 changed files with 31 additions and 11 deletions
15
.github/generate.py
vendored
15
.github/generate.py
vendored
|
|
@ -81,7 +81,7 @@ class ColumnDef:
|
|||
params: List["LuaParam"] = field(default_factory=list)
|
||||
|
||||
|
||||
HL = [LuaParam("highlight", "string|fun", "Highlight group")]
|
||||
HL = [LuaParam("highlight", "string|fun(value: string): string", "Highlight group, or function that returns a highlight group")]
|
||||
TIME = [
|
||||
LuaParam("format", "string", "Format string (see :help strftime)"),
|
||||
]
|
||||
|
|
@ -91,7 +91,8 @@ COL_DEFS = [
|
|||
"*",
|
||||
False,
|
||||
"The type of the entry (file, directory, link, etc)",
|
||||
HL + [LuaParam("icons", "table<string, string>", "Mapping of entry type to icon")],
|
||||
HL
|
||||
+ [LuaParam("icons", "table<string, string>", "Mapping of entry type to icon")],
|
||||
),
|
||||
ColumnDef(
|
||||
"icon",
|
||||
|
|
@ -101,7 +102,9 @@ COL_DEFS = [
|
|||
HL + [],
|
||||
),
|
||||
ColumnDef("size", "files, ssh", False, "The size of the file", HL + []),
|
||||
ColumnDef("permissions", "files, ssh", True, "Access permissions of the file", HL + []),
|
||||
ColumnDef(
|
||||
"permissions", "files, ssh", True, "Access permissions of the file", HL + []
|
||||
),
|
||||
ColumnDef("ctime", "files", False, "Change timestamp of the file", HL + TIME + []),
|
||||
ColumnDef(
|
||||
"mtime", "files", False, "Last modified time of the file", HL + TIME + []
|
||||
|
|
@ -140,6 +143,12 @@ def get_highlights_vimdoc() -> "VimdocSection":
|
|||
|
||||
def get_columns_vimdoc() -> "VimdocSection":
|
||||
section = VimdocSection("Columns", "oil-columns", ["\n"])
|
||||
section.body.extend(
|
||||
wrap(
|
||||
'Columns can be specified as a string to use default arguments (e.g. `"icon"`), or as a table to pass parameters (e.g. `{"size", highlight = "Special"}`)'
|
||||
)
|
||||
)
|
||||
section.body.append('\n')
|
||||
for col in COL_DEFS:
|
||||
section.body.append(leftright(col.name, f"*column-{col.name}*"))
|
||||
section.body.extend(wrap(f"Adapters: {col.adapters}", 4))
|
||||
|
|
|
|||
27
doc/oil.txt
27
doc/oil.txt
|
|
@ -158,12 +158,16 @@ setup({opts}) *oil.setu
|
|||
--------------------------------------------------------------------------------
|
||||
COLUMNS *oil-columns*
|
||||
|
||||
Columns can be specified as a string to use default arguments (e.g. `"icon"`),
|
||||
or as a table to pass parameters (e.g. `{"size", highlight = "Special"}`)
|
||||
|
||||
type *column-type*
|
||||
Adapters: *
|
||||
The type of the entry (file, directory, link, etc)
|
||||
|
||||
Parameters:
|
||||
{highlight} `string|fun` Highlight group
|
||||
{highlight} `string|fun(value: string): string` Highlight group, or
|
||||
function that returns a highlight group
|
||||
{icons} `table<string, string>` Mapping of entry type to icon
|
||||
|
||||
icon *column-icon*
|
||||
|
|
@ -171,14 +175,16 @@ icon *column-ico
|
|||
An icon for the entry's type (requires nvim-web-devicons)
|
||||
|
||||
Parameters:
|
||||
{highlight} `string|fun` Highlight group
|
||||
{highlight} `string|fun(value: string): string` Highlight group, or
|
||||
function that returns a highlight group
|
||||
|
||||
size *column-size*
|
||||
Adapters: files, ssh
|
||||
The size of the file
|
||||
|
||||
Parameters:
|
||||
{highlight} `string|fun` Highlight group
|
||||
{highlight} `string|fun(value: string): string` Highlight group, or
|
||||
function that returns a highlight group
|
||||
|
||||
permissions *column-permissions*
|
||||
Adapters: files, ssh
|
||||
|
|
@ -186,14 +192,16 @@ permissions *column-permission
|
|||
Access permissions of the file
|
||||
|
||||
Parameters:
|
||||
{highlight} `string|fun` Highlight group
|
||||
{highlight} `string|fun(value: string): string` Highlight group, or
|
||||
function that returns a highlight group
|
||||
|
||||
ctime *column-ctime*
|
||||
Adapters: files
|
||||
Change timestamp of the file
|
||||
|
||||
Parameters:
|
||||
{highlight} `string|fun` Highlight group
|
||||
{highlight} `string|fun(value: string): string` Highlight group, or
|
||||
function that returns a highlight group
|
||||
{format} `string` Format string (see :help strftime)
|
||||
|
||||
mtime *column-mtime*
|
||||
|
|
@ -201,7 +209,8 @@ mtime *column-mtim
|
|||
Last modified time of the file
|
||||
|
||||
Parameters:
|
||||
{highlight} `string|fun` Highlight group
|
||||
{highlight} `string|fun(value: string): string` Highlight group, or
|
||||
function that returns a highlight group
|
||||
{format} `string` Format string (see :help strftime)
|
||||
|
||||
atime *column-atime*
|
||||
|
|
@ -209,7 +218,8 @@ atime *column-atim
|
|||
Last access time of the file
|
||||
|
||||
Parameters:
|
||||
{highlight} `string|fun` Highlight group
|
||||
{highlight} `string|fun(value: string): string` Highlight group, or
|
||||
function that returns a highlight group
|
||||
{format} `string` Format string (see :help strftime)
|
||||
|
||||
birthtime *column-birthtime*
|
||||
|
|
@ -217,7 +227,8 @@ birthtime *column-birthtim
|
|||
The time the file was created
|
||||
|
||||
Parameters:
|
||||
{highlight} `string|fun` Highlight group
|
||||
{highlight} `string|fun(value: string): string` Highlight group, or
|
||||
function that returns a highlight group
|
||||
{format} `string` Format string (see :help strftime)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue