A column renderer is a Lua function that receives a special argument and returns a string that will be displayed in each specific field of the files table.
xplr.fn.custom.fmt_simple_column = function(m)
return m.prefix .. m.relative_path .. m.suffix
end
xplr.config.general.table.header.cols = {
{ format = " path" }
}
xplr.config.general.table.row.cols = {
{ format = "custom.fmt_simple_column" }
}
xplr.config.general.table.col_widths = {
{ Percentage = 100 }
}
-- With this config, you should only see a single column displaying the
-- relative paths.
xplr by default provides the following column renderers:
xplr.fn.builtin.fmt_general_table_row_cols_0
xplr.fn.builtin.fmt_general_table_row_cols_1
xplr.fn.builtin.fmt_general_table_row_cols_2
xplr.fn.builtin.fmt_general_table_row_cols_3
xplr.fn.builtin.fmt_general_table_row_cols_4
You can either overwrite these functions, or create new functions in
xplr.fn.custom
and point to them.
Terminal colors are supported.
The special argument contains the following fields
- parent
- relative_path
- absolute_path
- extension
- is_symlink
- is_broken
- is_dir
- is_file
- is_readonly
- mime_essence
- size
- human_size
- permissions
- created
- last_modified
- uid
- gid
- canonical
- symlink
- index
- relative_index
- is_before_focus
- is_after_focus
- tree
- prefix
- suffix
- is_selected
- is_focused
- total
- style
- meta
Type: string
The parent path of the node.
Type: string
The path relative to the parent, i.e. the file/directory name with extension.
Type: string
The absolute path (without resolving symlinks) of the node.
Type: string
The extension of the node.
Type: boolean
true
if the node is a symlink.
Type: boolean
true
if the node is a broken symlink.
Type: boolean
true
if the node is a directory.
Type: boolean
true
if the node is a file.
Type: boolean
true
if the node is real-only.
Type: string
The mime type of the node. For e.g. text/csv
, image/jpeg
etc.
Type: integer
The size of the exact node. The size of a directory won't be calculated recursively.
Type: string
Like size but in human readable format.
Type: Permission
The permissions applied to the node.
Type: nullable integer
Creation time in nanosecond since UNIX epoch.
Type: nullable integer
Last modification time in nanosecond since UNIX epoch.
Type: integer
User ID of the file owner.
Type: integer
Group ID of the file owner.
Type: nullable Resolved Node Metadata
If the node is a symlink, it will hold information about the symlink resolved node. Else, it will hold information the actual node. It the symlink is broken, it will be null.
Type: nullable Resolved Node Metadata
If the node is a symlink and is not broken, it will hold information about the symlink resolved node. However, it will never hold information about the actual node. It will instead be null.
Type: integer
Index (starting from 0) of the node.
Type: integer
Relative index from the focused node (i.e. 0th node).
Type: boolean
true
if the node is before the focused node.
Type: boolean
true
if the node is after the focused node.
Type: string
The tree component based on the node's index.
Type: string
The prefix applicable for the node.
Type: string
The suffix applicable for the node.
Type: boolean
true
if the node is selected.
Type: boolean
true
if the node is under focus.
Type: integer
The total number of the nodes.
Type: Style
The applicable style object for the node.
Type: mapping of string and string
The applicable meta object for the node.
Permission contains the following fields:
- user_read
- user_write
- user_execute
- group_read
- group_write
- group_execute
- other_read
- other_write
- other_execute
- sticky
- setgid
- setuid
Each field holds a boolean value.
It contains the following fields.