Skip to content

Commit 81b81d2

Browse files
committed
feat(status): add snacks.picker support to clickable components
1 parent 81ddd03 commit 81b81d2

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

lua/astroui/status/component.lua

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,11 @@ function M.git_branch(opts)
192192
on_click = {
193193
name = "heirline_branch",
194194
callback = function()
195-
if is_available "telescope.nvim" then require("telescope.builtin").git_branches { use_file_path = true } end
195+
if is_available "telescope.nvim" then
196+
require("telescope.builtin").git_branches { use_file_path = true }
197+
elseif is_available "snacks.nvim" then
198+
require("snacks").picker.git_branches()
199+
end
196200
end,
197201
},
198202
update = {
@@ -218,7 +222,11 @@ function M.git_diff(opts)
218222
on_click = {
219223
name = "heirline_git",
220224
callback = function()
221-
if is_available "telescope.nvim" then require("telescope.builtin").git_status { use_file_path = true } end
225+
if is_available "telescope.nvim" then
226+
require("telescope.builtin").git_status { use_file_path = true }
227+
elseif is_available "snacks.nvim" then
228+
require("snacks").picker.git_status()
229+
end
222230
end,
223231
},
224232
surround = { separator = "left", color = "git_diff_bg", condition = condition.git_changed },
@@ -255,7 +263,11 @@ function M.diagnostics(opts)
255263
on_click = {
256264
name = "heirline_diagnostic",
257265
callback = function()
258-
if is_available "telescope.nvim" then require("telescope.builtin").diagnostics() end
266+
if is_available "telescope.nvim" then
267+
require("telescope.builtin").diagnostics()
268+
elseif is_available "snacks.nvim" then
269+
require("snacks").picker.diagnostics()
270+
end
259271
end,
260272
},
261273
update = { "DiagnosticChanged", "BufEnter" },

0 commit comments

Comments
 (0)