refactor: simplify
This commit is contained in:
+6
-3
@@ -1,15 +1,18 @@
|
||||
local M = {}
|
||||
|
||||
--- Opens a TUI application in a simple centered floating window.
|
||||
-- Open a command in a simple centered floating window
|
||||
function M.open_terminal_app(cmd)
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
local w, h = math.floor(vim.o.columns * 0.95), math.floor(vim.o.lines * 0.95)
|
||||
|
||||
local lines = vim.o.lines - vim.o.cmdheight - (vim.o.laststatus > 0 and 1 or 0)
|
||||
local w = math.floor(vim.o.columns * 0.95)
|
||||
local h = math.floor(lines * 0.92)
|
||||
|
||||
local win = vim.api.nvim_open_win(buf, true, {
|
||||
relative = "editor",
|
||||
width = w,
|
||||
height = h,
|
||||
row = math.floor((vim.o.lines - h) / 2),
|
||||
row = math.floor((lines - h) / 2),
|
||||
col = math.floor((vim.o.columns - w) / 2),
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user