Update: 2024-11-21

This commit is contained in:
2024-11-21 14:02:29 +02:00
parent 7da57cd023
commit 74e444a83f
1010 changed files with 271 additions and 574412 deletions

View File

@@ -10,10 +10,22 @@ https://github.com/dedukun/relative-motions.yazi/assets/25795432/04fb186a-5efe-4
## Installation
If you use the latest Yazi from main branch
```sh
ya pack -a dedukun/relative-motions
```
If you are using <= v0.3.3
```sh
# Linux/macOS
git clone --branch 0.3.3 https://github.com/dedukun/relative-motions.yazi.git ~/.config/yazi/plugins/relative-motions.yazi
# Windows
git clone --branch 0.3.3 https://github.com/dedukun/relative-motions.yazi.git %AppData%\yazi\config\plugins\relative-motions.yazi
```
## Configuration
If you want to use the numbers directly to start a motion add this to your `keymap.toml`:
@@ -97,8 +109,8 @@ require("relative-motions"):setup({ show_numbers="relative", show_motion = true
```
> [!NOTE]
> The `show_numbers` and `show_motion` functionalities overwrite [`Current:render`](https://github.com/sxyazi/yazi/blob/43b5ae0e6cc5c8ee96462651f01d78a0d98077fc/yazi-plugin/preset/components/current.lua#L26)
> and [`Status:children_render`](https://github.com/sxyazi/yazi/blob/43b5ae0e6cc5c8ee96462651f01d78a0d98077fc/yazi-plugin/preset/components/status.lua#L172) respectively.
> The `show_numbers` and `show_motion` functionalities overwrite [`Current:redraw`](https://github.com/sxyazi/yazi/blob/e3c91115a2c096724303a0b364e7625691e4beba/yazi-plugin/preset/components/current.lua#L28)
> and [`Status:children_redraw`](https://github.com/sxyazi/yazi/blob/e3c91115a2c096724303a0b364e7625691e4beba/yazi-plugin/preset/components/status.lua#L177) respectively.
> If you have custom implementations for any of this functions
> you can add the provided `Entity:number` and `Status:motion` to your implementations, just check [here](https://github.com/dedukun/relative-motions.yazi/blob/main/init.lua#L126) how we are doing things.

View File

@@ -39,7 +39,7 @@ local render_motion_setup = ya.sync(function(_)
Status.motion = function() return ui.Span("") end
Status.children_render = function(self, side)
Status.children_redraw = function(self, side)
local lines = {}
if side == self.RIGHT then
lines[1] = self:motion(self)
@@ -107,7 +107,7 @@ local render_numbers = ya.sync(function(_, mode)
end
end
Current.render = function(self)
Current.redraw = function(self)
local files = self._folder.window
if #files == 0 then
return self:empty()
@@ -123,10 +123,10 @@ local render_numbers = ya.sync(function(_, mode)
local entities, linemodes = {}, {}
for i, f in ipairs(files) do
linemodes[#linemodes + 1] = Linemode:new(f):render()
linemodes[#linemodes + 1] = Linemode:new(f):redraw()
local entity = Entity:new(f)
entities[#entities + 1] = ui.Line({ Entity:number(i, f, hovered_index), entity:render() }):style(entity:style())
entities[#entities + 1] = ui.Line({ Entity:number(i, f, hovered_index), entity:redraw() }):style(entity:style())
end
return {