From 53a091389b55c2de515120f0dd0de532741a0b67 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Fri, 7 Jun 2024 14:04:02 +0200 Subject: [PATCH] refactor(ui): use `vim.fn.choice` --- lua/rocks_treesitter/highlight.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/rocks_treesitter/highlight.lua b/lua/rocks_treesitter/highlight.lua index ca5372b..df43659 100644 --- a/lua/rocks_treesitter/highlight.lua +++ b/lua/rocks_treesitter/highlight.lua @@ -76,9 +76,8 @@ local function prompt_auto_install(rocks) -- TODO: Enable check when we have tagged releases -- if #rocks == 1 then local rock = rocks[1] - local yesno = vim.fn.input("Install " .. rock.name .. "? y/n: ") - print("\n ") - install_rock_or_mark_declined(string.match(yesno, "^y.*") and rock.version) + local choice = vim.fn.confirm("Install " .. rock.name .. "?", "y/n", "n", "Question") + install_rock_or_mark_declined(choice == 1 and rock.version or nil) -- elseif #rocks > 1 then -- local choices = vim.iter(rocks) -- :map(function(rock)