🐻 minimal ui2 fuzzy finder for Neovim codeberg.org/comfysage/artio.nvim
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add split and vsplit actions to file picker

robin 6acaf0d4 6e27dc60

+46
+3
lua/artio/builtins.lua
··· 47 47 {}, 48 48 utils.make_setqflistactions(function(item) 49 49 return { filename = item.v } 50 + end), 51 + utils.make_fileactions(function(item) 52 + return vim.fn.bufnr(item.v, true) 50 53 end) 51 54 ), 52 55 }, props)
+2
lua/artio/config.lua
··· 50 50 ["<c-l>"] = "togglepreview", 51 51 ["<c-q>"] = "setqflist", 52 52 ["<m-q>"] = "setqflistmark", 53 + ["<c-s>"] = "split", 54 + ["<c-v>"] = "vsplit", 53 55 }, 54 56 } 55 57
+14
lua/artio/picker.lua
··· 220 220 :totable() 221 221 end 222 222 223 + ---@param idx? integer index in items 224 + ---@return artio.Picker.item? 225 + function Picker:getcurrent(idx) 226 + if not idx then 227 + local i = self.idx 228 + idx = self.matches[i] and self.matches[i][1] 229 + end 230 + if not idx then 231 + return 232 + end 233 + 234 + return self.items[idx] 235 + end 236 + 223 237 return Picker
+27
lua/artio/utils.lua
··· 75 75 } 76 76 end 77 77 78 + ---@param fn fun(item: artio.Picker.item): integer 79 + ---@return table<string, artio.Picker.action> 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 87 + return 88 + end 89 + local buf = fn(item) 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 97 + return 98 + end 99 + local buf = fn(item) 100 + vim.api.nvim_open_win(buf, true, { win = -1, vertical = true }) 101 + end), 102 + } 103 + end 104 + 78 105 return utils