summaryrefslogtreecommitdiff
path: root/lua/aotrix/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lua/aotrix/plugins')
-rw-r--r--lua/aotrix/plugins/build.lua52
1 files changed, 42 insertions, 10 deletions
diff --git a/lua/aotrix/plugins/build.lua b/lua/aotrix/plugins/build.lua
index 54d18af..6dec5ac 100644
--- a/lua/aotrix/plugins/build.lua
+++ b/lua/aotrix/plugins/build.lua
@@ -103,17 +103,49 @@ return {
end
local selectCommand = function(listOfCommands, callback)
- vim.ui.select(vim.tbl_keys(listOfCommands), {
- prompt = "Select your command.",
- format_item = function(item)
- return listOfCommands[item].description()
- end
- }, function(choice)
- if (choice ~= nil) then
- CURRENT_COMMAND = listOfCommands[choice].command
- callback(choice)
+ local Menu = require("nui.menu")
+ local menu = Menu({
+ position = "50%",
+ size = {width = "80%", height = "80%"},
+ border = {
+ style = "single",
+ text = {top = "[Choose a command]", top_align = "center"}
+ },
+ win_options = {
+ winhighlight = "Normal:Normal,FloatBorder:Normal"
+ }
+ }, {
+ lines = {
+ Menu.item("Hydrogen (H)"), Menu.item("Carbon (C)"),
+ Menu.item("Nitrogen (N)"), Menu.item("Helium (He)"),
+ Menu.item("Neon (Ne)"), Menu.item("Argon (Ar)")
+ },
+ max_width = 100,
+ keymap = {
+ focus_next = {"j", "<Down>", "<Tab>"},
+ focus_prev = {"k", "<Up>", "<S-Tab>"},
+ close = {"<Esc>", "<C-c>"},
+ submit = {"<CR>", "<Space>"}
+ },
+ on_submit = function(item)
+ print("Menu Submitted: ", item.text)
end
- end)
+ })
+
+ -- mount the component
+ menu:mount()
+
+ -- vim.ui.select(vim.tbl_keys(listOfCommands), {
+ -- prompt = "Select your command.",
+ -- format_item = function(item)
+ -- return listOfCommands[item].description()
+ -- end
+ -- }, function(choice)
+ -- if (choice ~= nil) then
+ -- CURRENT_COMMAND = listOfCommands[choice].command
+ -- callback(choice)
+ -- end
+ -- end)
end
local addCommand = function(current_command, commands,