Skip to content

Commit f105a17

Browse files
committed
yazi: clean up relative-motions plugin formatting
1 parent f19aee3 commit f105a17

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

dot_config/yazi/plugins/relative-motions.yazi/readonly_main.lua

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ local render_motion_setup = ya.sync(function(_)
4646
ya.render()
4747
end
4848

49-
Status.motion = function() return ui.Span("") end
49+
Status.motion = function()
50+
return ui.Span("")
51+
end
5052

5153
Status.children_redraw = function(self, side)
5254
local lines = {}
@@ -58,9 +60,6 @@ local render_motion_setup = ya.sync(function(_)
5860
end
5961
return ui.Line(lines)
6062
end
61-
62-
-- TODO: check why it doesn't work line this
63-
-- Status:children_add(function() return ui.Span("") end, 1000, Status.RIGHT)
6463
end)
6564

6665
local render_motion = ya.sync(function(_, motion_num, motion_cmd)
@@ -96,12 +95,12 @@ local render_motion = ya.sync(function(_, motion_num, motion_cmd)
9695
bg_style = style.main.bg
9796
end
9897

99-
return ui.Line {
98+
return ui.Line({
10099
ui.Span(separator_open):fg(bg_style),
101100
motion_span:style(style.main),
102101
ui.Span(separator_close):fg(bg_style),
103102
ui.Span(" "),
104-
}
103+
})
105104
end
106105
end)
107106

@@ -155,8 +154,9 @@ local render_numbers = ya.sync(function(_, mode)
155154
linemodes[#linemodes + 1] = Linemode:new(f):redraw()
156155

157156
local entity = Entity:new(f)
158-
entities[#entities + 1] = ui.Line({ Entity:number(i, #self._folder.files, f, hovered_index), entity:redraw() })
159-
:style(entity:style())
157+
entities[#entities + 1] =
158+
ui.Line({ Entity:number(i, #self._folder.files, f, hovered_index), entity:redraw() })
159+
:style(entity:style())
160160
end
161161

162162
return {
@@ -166,13 +166,17 @@ local render_numbers = ya.sync(function(_, mode)
166166
end
167167
end)
168168

169-
local function render_clear() render_motion() end
169+
local function render_clear()
170+
render_motion()
171+
end
170172

171173
-----------------------------------------------
172174
--------- C O M M A N D P A R S E R ---------
173175
-----------------------------------------------
174176

175-
local get_keys = ya.sync(function(state) return state._only_motions and MOTION_KEYS or MOTIONS_AND_OP_KEYS end)
177+
local get_keys = ya.sync(function(state)
178+
return state._only_motions and MOTION_KEYS or MOTIONS_AND_OP_KEYS
179+
end)
176180

177181
local function normal_direction(dir)
178182
if dir == "<Down>" then
@@ -193,7 +197,7 @@ local function get_cmd(first_char, keys)
193197

194198
while true do
195199
render_motion(tonumber(lines))
196-
local key = ya.which { cands = keys, silent = true }
200+
local key = ya.which({ cands = keys, silent = true })
197201
if not key then
198202
return nil, nil, nil
199203
end
@@ -215,7 +219,7 @@ local function get_cmd(first_char, keys)
215219
DIRECTION_KEYS[#DIRECTION_KEYS + 1] = {
216220
on = last_key,
217221
}
218-
local direction_key = ya.which { cands = DIRECTION_KEYS, silent = true }
222+
local direction_key = ya.which({ cands = DIRECTION_KEYS, silent = true })
219223
if not direction_key then
220224
return nil, nil, nil
221225
end
@@ -237,7 +241,9 @@ local function is_tab_command(command)
237241
return false
238242
end
239243

240-
local get_active_tab = ya.sync(function(_) return cx.tabs.idx end)
244+
local get_active_tab = ya.sync(function(_)
245+
return cx.tabs.idx
246+
end)
241247

242248
local get_cache_or_first_dir = ya.sync(function(state)
243249
if state._enter_mode == ENTER_MODE_CACHE then

0 commit comments

Comments
 (0)