Update remap.lua

main
Dominik Madarász 2024-11-14 19:29:50 +01:00
parent 1af52240b3
commit 205dcf2f42
1 changed files with 5 additions and 5 deletions

View File

@ -57,25 +57,25 @@ function toggleTerminal()
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
-- If the terminal is open in the current window, hide it -- If the terminal is open in the current window, hide it
if vim.api.nvim_get_current_buf() == term_buf then if vim.api.nvim_get_current_buf() == term_buf then
ToggleZen() -- ToggleZen()
vim.cmd("close") vim.cmd("close")
vim.cmd("wincmd w") vim.cmd("wincmd w")
else else
-- Otherwise, open the terminal buffer in a split at the bottom -- Otherwise, open the terminal buffer in a split at the bottom
vim.cmd("wincmd w") vim.cmd("wincmd w")
vim.cmd("belowright split | resize " .. math.floor(vim.o.lines * 0.25)) vim.cmd("belowright split | resize " .. math.floor(vim.o.lines * 0.99))
vim.api.nvim_set_current_buf(term_buf) vim.api.nvim_set_current_buf(term_buf)
vim.cmd("startinsert") vim.cmd("startinsert")
ToggleZen() -- ToggleZen()
end end
else else
-- If no terminal buffer exists, create a new one -- If no terminal buffer exists, create a new one
vim.cmd("wincmd w") vim.cmd("wincmd w")
vim.cmd("belowright split | resize " .. math.floor(vim.o.lines * 0.25)) vim.cmd("belowright split | resize " .. math.floor(vim.o.lines * 0.99))
vim.cmd("terminal") vim.cmd("terminal")
vim.cmd("startinsert") vim.cmd("startinsert")
term_buf = vim.api.nvim_get_current_buf() -- Store the terminal buffer ID term_buf = vim.api.nvim_get_current_buf() -- Store the terminal buffer ID
ToggleZen() -- ToggleZen()
end -- Check if the current buffer is a terminal end -- Check if the current buffer is a terminal
end end