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(builtins): builtins picker
robinwobin.dev
1 week ago
da89202f
50ea75fe
+34
-1
2 changed files
expand all
collapse all
unified
split
lua
artio
builtins.lua
plugin
artio.lua
+29
lua/artio/builtins.lua
···
16
16
17
17
local builtins = {}
18
18
19
19
+
builtins.builtins = function(props)
20
20
+
props = props or {}
21
21
+
22
22
+
return artio.generic(
23
23
+
vim.tbl_keys(builtins),
24
24
+
extend({
25
25
+
prompt = "builtins",
26
26
+
on_close = function(fname, _)
27
27
+
if not builtins[fname] then
28
28
+
return
29
29
+
end
30
30
+
31
31
+
local Picker = require("artio.picker")
32
32
+
local current = Picker.active_picker
33
33
+
if not current or not current.closed then
34
34
+
return
35
35
+
end
36
36
+
37
37
+
vim.schedule(function()
38
38
+
vim.defer_fn(builtins[fname], 10)
39
39
+
vim.wait(1000, function()
40
40
+
return coroutine.status(current.co) == "dead"
41
41
+
end)
42
42
+
end)
43
43
+
end,
44
44
+
}, props)
45
45
+
)
46
46
+
end
47
47
+
19
48
local findprg = vim.fn.executable("fd") == 1 and "fd -H -p -a -t f --color=never --"
20
49
or "find . -type f -iregex '.*$*.*'"
21
50
+5
-1
plugin/artio.lua
···
34
34
35
35
vim.api.nvim_create_user_command("Artio", function(opts)
36
36
local builtins = require("artio.builtins")
37
37
+
if #opts.fargs == 0 then
38
38
+
builtins.builtins()
39
39
+
return
40
40
+
end
37
41
local builtin = builtins[opts.fargs[1]]
38
42
if not builtin then
39
43
vim.notify("unknown builtin: " .. opts.fargs[1], vim.log.levels.ERROR)
···
41
45
end
42
46
builtin()
43
47
end, {
44
44
-
nargs = 1,
48
48
+
nargs = "?",
45
49
complete = function(_, _, _)
46
50
return vim.tbl_keys(require("artio.builtins"))
47
51
end,