summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-06-02 22:11:24 +0200
committerHampusM <hampus@hampusmat.com>2024-06-02 22:11:24 +0200
commit4a61ce3e2a7b11e5d94fc047ffdd7351623df199 (patch)
tree0cf30e5b8b2989e4cab6bc0bea65fae1fd01888d
parent94f56f1e29f155a249ca87811ac53ad756f4e4f5 (diff)
make terminal windows unlisted
-rw-r--r--lua/functions.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/lua/functions.lua b/lua/functions.lua
index aa5e32f..3b52a55 100644
--- a/lua/functions.lua
+++ b/lua/functions.lua
@@ -50,7 +50,13 @@ function _G.toggle_terminal()
if vim.fn.win_gotoid(vim.g.term_win) == 1 then
vim.cmd("quit!")
else
- vim.cmd("botright new")
+ local terminal_buffer = vim.api.nvim_create_buf(false, false)
+
+ vim.api.nvim_open_win(
+ terminal_buffer,
+ true,
+ { split = "below", vertical = true }
+ )
vim.api.nvim_win_set_height(vim.fn.win_getid(), vim.g.terminal_height)
@@ -63,7 +69,7 @@ function _G.toggle_terminal()
vim.fn.termopen(vim.env.SHELL, {detach=0})
- vim.g.term_buf = vim.fn.bufnr("")
+ vim.g.term_buf = terminal_buffer
vim.o.number = false
vim.o.relativenumber = false