Update remap.lua
parent
1af52240b3
commit
205dcf2f42
|
@ -57,25 +57,25 @@ function toggleTerminal()
|
|||
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 vim.api.nvim_get_current_buf() == term_buf then
|
||||
ToggleZen()
|
||||
-- ToggleZen()
|
||||
vim.cmd("close")
|
||||
vim.cmd("wincmd w")
|
||||
else
|
||||
-- Otherwise, open the terminal buffer in a split at the bottom
|
||||
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.cmd("startinsert")
|
||||
ToggleZen()
|
||||
-- ToggleZen()
|
||||
end
|
||||
else
|
||||
-- If no terminal buffer exists, create a new one
|
||||
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("startinsert")
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue