···220220 :totable()
221221end
222222223223+---@param idx? integer index in items
224224+---@return artio.Picker.item?
225225+function Picker:getcurrent(idx)
226226+ if not idx then
227227+ local i = self.idx
228228+ idx = self.matches[i] and self.matches[i][1]
229229+ end
230230+ if not idx then
231231+ return
232232+ end
233233+234234+ return self.items[idx]
235235+end
236236+223237return Picker
+27
lua/artio/utils.lua
···7575 }
7676end
77777878+---@param fn fun(item: artio.Picker.item): integer
7979+---@return table<string, artio.Picker.action>
8080+function utils.make_fileactions(fn)
8181+ return {
8282+ split = require("artio").wrap(function(self)
8383+ coroutine.resume(self.co, 1)
8484+ end, function(self)
8585+ local item = self:getcurrent()
8686+ if not item then
8787+ return
8888+ end
8989+ local buf = fn(item)
9090+ vim.api.nvim_open_win(buf, true, { win = -1, vertical = false })
9191+ end),
9292+ vsplit = require("artio").wrap(function(self)
9393+ coroutine.resume(self.co, 1)
9494+ end, function(self)
9595+ local item = self:getcurrent()
9696+ if not item then
9797+ return
9898+ end
9999+ local buf = fn(item)
100100+ vim.api.nvim_open_win(buf, true, { win = -1, vertical = true })
101101+ end),
102102+ }
103103+end
104104+78105return utils