diff options
| author | Aotrix <[email protected]> | 2026-08-16 03:38:02 +0200 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2026-08-16 03:38:02 +0200 |
| commit | 2b9c63e75de26a8cbb35a0d3157c7ee7e41de75c (patch) | |
| tree | 861b23dd184e11a77f9a6784d46ad82f3809c4c3 | |
| parent | 670439e2802de9ef1fd3fe6271b581352a1f8fc4 (diff) | |
Update command registration UI
| -rw-r--r-- | lua/aotrix/plugins/build.lua | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/lua/aotrix/plugins/build.lua b/lua/aotrix/plugins/build.lua index a7c5dfe..ed79189 100644 --- a/lua/aotrix/plugins/build.lua +++ b/lua/aotrix/plugins/build.lua @@ -139,6 +139,8 @@ return { local selectedCommand = nil local Input = require("nui.input") + local Layout = require("nui.layout") + local event = require("nui.utils.autocmd").event local inputDescription = Input({ position = "50%", size = {width = 120}, @@ -171,7 +173,6 @@ return { end }) local input = Input({ - position = "50%", size = {width = 120}, border = { style = "single", @@ -185,21 +186,33 @@ return { 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() - input:map("n", "<Esc>", function() input:unmount() end, {noremap = true}) + inputDescription:map("n", "<Esc>", + function() + inputDescription:unmount() + end, {noremap = true}) + + inputDescription:on(event.BufEnter, function() + local insert = vim.api.nvim_replace_termcodes("i", true, true, + true) + vim.api.nvim_feedkeys(insert, "t", false) + end) + + local layout = Layout({ + position = "0%", + size = {width = "100%", height = "100%"} + }, Layout.Box({ + Layout.Box(input, {size = {width = "50%", height = "100%"}}), + Layout.Box(inputDescription, + {size = {width = "50%", height = "100%"}}) + }, {dir = "row"})) + + layout:mount() + end local deleteCommand = function() |
