summaryrefslogtreecommitdiff
path: root/lua/aotrix/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lua/aotrix/plugins')
-rw-r--r--lua/aotrix/plugins/build.lua33
1 files changed, 27 insertions, 6 deletions
diff --git a/lua/aotrix/plugins/build.lua b/lua/aotrix/plugins/build.lua
index c940993..a0a642c 100644
--- a/lua/aotrix/plugins/build.lua
+++ b/lua/aotrix/plugins/build.lua
@@ -120,14 +120,13 @@ return {
personal_command_json_path)
local selectedCommand = nil
- local event = require("nui.utils.autocmd").event
local Input = require("nui.input")
- local input = Input({
+ local inputDescription = Input({
position = "50%",
size = {width = 120},
border = {
style = "single",
- text = {top = "[Howdy?]", top_align = "center"}
+ text = {top = "[Enter description]", top_align = "center"}
},
win_options = {
winhighlight = "Normal:Normal,FloatBorder:Normal"
@@ -136,9 +135,7 @@ return {
prompt = "> ",
default_value = "",
on_submit = function(value)
- selectedCommand = value
- local selectedDescription = vim.fn.input(
- 'Name the command: ')
+ local selectedDescription = value
commands[selectedDescription] = {
command = function()
return selectedCommand
@@ -155,6 +152,30 @@ return {
executeCommandInTerminal(current_command)
end
})
+ local input = Input({
+ position = "50%",
+ size = {width = 120},
+ border = {
+ style = "single",
+ text = {top = "[Add command]", top_align = "center"}
+ },
+ win_options = {
+ winhighlight = "Normal:Normal,FloatBorder:Normal"
+ }
+ }, {
+ prompt = "> ",
+ default_value = "",
+ on_submit = function(value)
+ selectedCommand = value
+ inputDescription:mount()
+ local insert = vim.api.nvim_replace_termcodes("i", true,
+ true, true)
+ vim.api.nvim_feedkeys(insert, "t", false)
+ inputDescription:map("n", "<Esc>", function()
+ inputDescription:unmount()
+ end, {noremap = true})
+ end
+ })
-- mount/open the component
input:mount()