minimal extui fuzzy finder for neovim

fix(picker): create `Picker:accept()` and `Picker:cancel()`

+15 -7
+8
lua/artio/picker.lua
··· 164 end) 165 end 166 167 function Picker:fix() 168 self.idx = math.max(self.idx, self.opts.preselect and 1 or 0) 169 self.idx = math.min(self.idx, #self.matches)
··· 164 end) 165 end 166 167 + function Picker:accept() 168 + coroutine.resume(self.co, action_enum.accept) 169 + end 170 + 171 + function Picker:cancel() 172 + coroutine.resume(self.co, action_enum.cancel) 173 + end 174 + 175 function Picker:fix() 176 self.idx = math.max(self.idx, self.opts.preselect and 1 or 0) 177 self.idx = math.min(self.idx, #self.matches)
+5 -5
lua/artio/utils.lua
··· 42 return qfitem 43 end) 44 :totable()) 45 - coroutine.resume(self.co, 1) 46 end, function(_) 47 vim.cmd.copen() 48 end) ··· 60 return qfitem 61 end) 62 :totable()) 63 - coroutine.resume(self.co, 1) 64 end, function(_) 65 vim.cmd.copen() 66 end) ··· 80 function utils.make_fileactions(fn) 81 return { 82 split = require("artio").wrap(function(self) 83 - coroutine.resume(self.co, 1) 84 end, function(self) 85 local item = self:getcurrent() 86 if not item then ··· 90 vim.api.nvim_open_win(buf, true, { win = -1, vertical = false }) 91 end), 92 vsplit = require("artio").wrap(function(self) 93 - coroutine.resume(self.co, 1) 94 end, function(self) 95 local item = self:getcurrent() 96 if not item then ··· 100 vim.api.nvim_open_win(buf, true, { win = -1, vertical = true }) 101 end), 102 tabnew = require("artio").wrap(function(self) 103 - coroutine.resume(self.co, 1) 104 end, function(self) 105 local item = self:getcurrent() 106 if not item then
··· 42 return qfitem 43 end) 44 :totable()) 45 + self:cancel() 46 end, function(_) 47 vim.cmd.copen() 48 end) ··· 60 return qfitem 61 end) 62 :totable()) 63 + self:cancel() 64 end, function(_) 65 vim.cmd.copen() 66 end) ··· 80 function utils.make_fileactions(fn) 81 return { 82 split = require("artio").wrap(function(self) 83 + self:cancel() 84 end, function(self) 85 local item = self:getcurrent() 86 if not item then ··· 90 vim.api.nvim_open_win(buf, true, { win = -1, vertical = false }) 91 end), 92 vsplit = require("artio").wrap(function(self) 93 + self:cancel() 94 end, function(self) 95 local item = self:getcurrent() 96 if not item then ··· 100 vim.api.nvim_open_win(buf, true, { win = -1, vertical = true }) 101 end), 102 tabnew = require("artio").wrap(function(self) 103 + self:cancel() 104 end, function(self) 105 local item = self:getcurrent() 106 if not item then
+2 -2
plugin/artio.lua
··· 96 "i", 97 "<Plug>(artio-action-accept)", 98 wrap(function(self) 99 - coroutine.resume(self.co, 0) 100 end) 101 ) 102 vim.keymap.set( 103 "i", 104 "<Plug>(artio-action-cancel)", 105 wrap(function(self) 106 - coroutine.resume(self.co, 1) 107 end) 108 ) 109 vim.keymap.set(
··· 96 "i", 97 "<Plug>(artio-action-accept)", 98 wrap(function(self) 99 + self:accept() 100 end) 101 ) 102 vim.keymap.set( 103 "i", 104 "<Plug>(artio-action-cancel)", 105 wrap(function(self) 106 + self:cancel() 107 end) 108 ) 109 vim.keymap.set(