Skip to content

Commit

Permalink
docs: update configuration docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Aug 2, 2024
1 parent ab12f61 commit 7e426d2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
3 changes: 0 additions & 3 deletions docs/configuration/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,6 @@ Set the [line mode](/docs/configuration/yazi#manager.linemode).
| `mtime` | Display the last modified time of the file. |
| `owner` | Display the owner of the file, only available on Unix-like systems. |

In addition, you can also specify any 1 to 20 characters, and extend it within a UI plugin.
Which means you can implement your own linemode through the plugin by simply overriding the [`Folder:linemode` method](https://github.com/sxyazi/yazi/blob/shipped/yazi-plugin/preset/components/folder.lua).

### `search` {#manager.search}

| Argument/Option | Description |
Expand Down
26 changes: 24 additions & 2 deletions docs/configuration/yazi.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,30 @@ Line mode: display information associated with the file on the right side of the
- `"mtime"`: Display the last modified time of the file.
- `"owner"`: Display the owner of the file, only available on Unix-like systems.

In addition, you can also specify any 1 to 20 characters, and extend it within a UI plugin.
Which means you can implement your own linemode through the plugin by simply overriding the [`Folder:linemode` method](https://github.com/sxyazi/yazi/blob/shipped/yazi-plugin/preset/components/folder.lua).
You can also specify any 1 to 20 characters, and extend it within a UI plugin, which means you can implement your own linemode through the plugin system like this:

```toml
# ~/.config/yazi/yazi.toml
[manager]
linemode = "size_and_mtime"
```

```lua
-- ~/.config/yazi/init.lua
function Linemode:size_and_mtime()
local year = os.date("%Y")
local time = (self._file.cha.modified or 0) // 1

if time > 0 and os.date("%Y", time) == year then
time = os.date("%b %d %H:%M", time)
else
time = time and os.date("%b %d %Y", time) or ""
end

local size = self._file:size()
return ui.Line(string.format(" %s %s ", size and ya.readable_size(size):gsub(" ", "") or "-", time))
end
```

### `show_hidden` {#manager.show_hidden}

Expand Down

0 comments on commit 7e426d2

Please sign in to comment.