diff --git a/symlinks/config/nvim/lua/esensar/ui/init.lua b/symlinks/config/nvim/lua/esensar/ui/init.lua new file mode 100644 index 0000000..59a97cf --- /dev/null +++ b/symlinks/config/nvim/lua/esensar/ui/init.lua @@ -0,0 +1,39 @@ +-- Common UI components + +local nui_split = require("nui.split") +local nui_popup = require("nui.popup") + +local M = {} + +function M.new_bottom_split(opts) + local split = nui_split(vim.tbl_extend("force", { + relative = "editor", + position = "bottom", + size = "20%", + }, opts)) + + split:mount() + + return split +end + +function M.new_centered_popup(opts) + local split = nui_popup(vim.tbl_extend('force', { + enter = true, + focusable = true, + border = { + style = "rounded", + }, + position = "50%", + size = { + width = "80%", + height = "60%", + }, + }, opts)) + + split:mount() + + return split +end + +return M diff --git a/symlinks/config/nvim/plugin/ui.lua b/symlinks/config/nvim/plugin/ui.lua index 1c72261..5f24e60 100644 --- a/symlinks/config/nvim/plugin/ui.lua +++ b/symlinks/config/nvim/plugin/ui.lua @@ -80,3 +80,9 @@ end -- Selections -- Using telescope for select UI + +-- Terminal +vim.api.nvim_create_user_command("BottomTerminal", function() + require("esensar.ui").new_bottom_split({}) + vim.fn.termopen(os.getenv("SHELL")) +end, {})