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
fix: cwd rel of file pickers
robinwobin.dev
6 days ago
ed7b767e
be04fab4
+23
-7
2 changed files
expand all
collapse all
unified
split
lua
artio
builtins.lua
utils.lua
+15
-3
lua/artio/builtins.lua
···
16
16
17
17
local builtins = {}
18
18
19
19
-
local findprg = "fd -H -p -t f --color=never"
19
19
+
local findprg = "fd -H -p -a -t f --color=never"
20
20
21
21
---@class artio.picker.files.Props : artio.Picker.config
22
22
---@field findprg? string
···
26
26
props = props or {}
27
27
props.findprg = props.findprg or findprg
28
28
29
29
-
local lst = utils.make_cmd(props.findprg)()
29
29
+
local base_dir = vim.fn.getcwd(0)
30
30
+
local lst = utils.make_cmd(props.findprg, {
31
31
+
cwd = base_dir,
32
32
+
})()
30
33
31
34
return artio.generic(
32
35
lst,
···
36
39
vim.schedule(function()
37
40
vim.cmd.edit(text)
38
41
end)
42
42
+
end,
43
43
+
format_item = function(item)
44
44
+
return vim.fs.relpath(base_dir, item) or item
39
45
end,
40
46
get_icon = config.get().opts.use_icons and function(item)
41
47
return require("mini.icons").get("file", item.v)
···
288
294
currentfile = vim.fs.abspath(currentfile)
289
295
290
296
props.findprg = props.findprg or findprg
291
291
-
local lst = utils.make_cmd(props.findprg)()
297
297
+
local base_dir = vim.fn.getcwd(0)
298
298
+
local lst = utils.make_cmd(props.findprg, {
299
299
+
cwd = base_dir,
300
300
+
})()
292
301
293
302
local pwd = vim.fn.getcwd()
294
303
local recentlst = vim
···
329
338
vim.schedule(function()
330
339
vim.cmd.edit(text)
331
340
end)
341
341
+
end,
342
342
+
format_item = function(item)
343
343
+
return vim.fs.relpath(base_dir, item) or item
332
344
end,
333
345
get_icon = config.get().opts.use_icons and function(item)
334
346
return require("mini.icons").get("file", item.v)
+8
-4
lua/artio/utils.lua
···
11
11
end
12
12
13
13
---@param prg? string
14
14
+
---@param opts? table
14
15
---@return fun(arg?: string): string[]
15
15
-
function utils.make_cmd(prg)
16
16
+
function utils.make_cmd(prg, opts)
16
17
return function(arg)
17
18
if not prg then
18
19
return {}
···
23
24
cmd = ("%s %s"):format(prg, arg)
24
25
end
25
26
return cmd_callback(vim
26
26
-
.system({ vim.o.shell, "-c", cmd }, {
27
27
-
text = true,
28
28
-
})
27
27
+
.system(
28
28
+
{ vim.o.shell, "-c", cmd },
29
29
+
vim.tbl_extend("force", {
30
30
+
text = true,
31
31
+
}, opts or {})
32
32
+
)
29
33
:wait())
30
34
end
31
35
end