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
style: fmt
robinwobin.dev
4 months ago
1bfd192e
23db0597
+26
-18
4 changed files
expand all
collapse all
unified
split
lua
artio
builtins.lua
config.lua
init.lua
view.lua
+5
-4
lua/artio/builtins.lua
···
107
107
return vim.api.nvim_buf_get_lines(buf, row - 1, row, true)[1]
108
108
end,
109
109
preview_item = function(row)
110
110
-
return buf, function(w)
111
111
-
vim.api.nvim_set_option_value('cursorline', true, { scope = 'local', win = w })
112
112
-
vim.api.nvim_win_set_cursor(w, { row, 0 })
113
113
-
end
110
110
+
return buf,
111
111
+
function(w)
112
112
+
vim.api.nvim_set_option_value("cursorline", true, { scope = "local", win = w })
113
113
+
vim.api.nvim_win_set_cursor(w, { row, 0 })
114
114
+
end
114
115
end,
115
116
get_icon = function(row)
116
117
local v = tostring(row.v)
+1
-1
lua/artio/config.lua
···
41
41
width = vim.o.columns,
42
42
height = view.win.height,
43
43
col = 0,
44
44
-
row = vim.o.lines - vim.o.cmdheight * 2 - 1 - (vim.o.winborder == 'none' and 0 or 2),
44
44
+
row = vim.o.lines - vim.o.cmdheight * 2 - 1 - (vim.o.winborder == "none" and 0 or 2),
45
45
}
46
46
end,
47
47
},
+12
-9
lua/artio/init.lua
···
92
92
---@param on_choice fun(item: T|nil, idx: integer|nil)
93
93
---@param start_opts? artio.Picker.proto
94
94
artio.select = function(items, opts, on_choice, start_opts)
95
95
-
return artio.generic(items, vim.tbl_deep_extend("force", {
96
96
-
prompt = opts.prompt,
97
97
-
on_close = function(_, idx)
98
98
-
return on_choice(items[idx], idx)
99
99
-
end,
100
100
-
format_item = opts.format_item and function(item)
101
101
-
return opts.format_item(item)
102
102
-
end or nil,
103
103
-
}, start_opts or {}))
95
95
+
return artio.generic(
96
96
+
items,
97
97
+
vim.tbl_deep_extend("force", {
98
98
+
prompt = opts.prompt,
99
99
+
on_close = function(_, idx)
100
100
+
return on_choice(items[idx], idx)
101
101
+
end,
102
102
+
format_item = opts.format_item and function(item)
103
103
+
return opts.format_item(item)
104
104
+
end or nil,
105
105
+
}, start_opts or {})
106
106
+
)
104
107
end
105
108
106
109
---@generic T
+8
-4
lua/artio/view.lua
···
490
490
end
491
491
492
492
if not self.preview_win then
493
493
-
self.preview_win = vim.api.nvim_open_win(buf, false, vim.tbl_extend("force", self.picker.win.preview_opts(self), {
494
494
-
relative = "editor",
495
495
-
style = "minimal",
496
496
-
}))
493
493
+
self.preview_win = vim.api.nvim_open_win(
494
494
+
buf,
495
495
+
false,
496
496
+
vim.tbl_extend("force", self.picker.win.preview_opts(self), {
497
497
+
relative = "editor",
498
498
+
style = "minimal",
499
499
+
})
500
500
+
)
497
501
else
498
502
vim.api.nvim_win_set_buf(self.preview_win, buf)
499
503
end