tangled
alpha
login
or
join now
robinwobin.dev
/
artio.nvim
3
fork
atom
minimal extui fuzzy finder for neovim
3
fork
atom
overview
issues
pulls
pipelines
feat(picker)!: pass actions directly to picker
robinwobin.dev
3 months ago
1e464edd
9fca634b
+5
-3
1 changed file
expand all
collapse all
unified
split
lua
artio
picker.lua
+5
-3
lua/artio/picker.lua
···
5
5
---@alias artio.Picker.match [integer, integer[], integer] [item, pos[], score]
6
6
---@alias artio.Picker.sorter fun(lst: artio.Picker.item[], input: string): artio.Picker.match[]
7
7
---@alias artio.Picker.hl [[integer, integer], string]
8
8
+
---@alias artio.Picker.action fun(self: artio.Picker, co: thread)
8
9
9
10
---@class artio.Picker.config
10
11
---@field items artio.Picker.item[]|string[]
···
15
16
---@field preview_item? fun(item: any): integer, fun(win: integer)
16
17
---@field get_icon? fun(item: artio.Picker.item): string, string
17
18
---@field hl_item? fun(item: artio.Picker.item): artio.Picker.hl[]
18
18
-
---@field actions? artio.Actions
19
19
+
---@field actions? table<string, artio.Picker.action>
19
20
---@field prompt? string
20
21
---@field defaulttext? string
21
22
---@field prompttext? string
···
26
27
---@class artio.Picker : artio.Picker.config
27
28
---@field idx integer 1-indexed
28
29
---@field matches artio.Picker.match[]
30
30
+
---@field actions? artio.Actions
29
31
local Picker = {}
30
32
Picker.__index = Picker
31
33
···
75
77
76
78
Picker.getitems(t, "")
77
79
78
78
-
t.actions = t.actions or Actions:new({
79
79
-
actions = default_actions,
80
80
+
t.actions = Actions:new({
81
81
+
actions = vim.tbl_extend("force", default_actions, t.actions or {}),
80
82
})
81
83
82
84
return setmetatable(t, Picker)