Toggle term better than built in.

This commit is contained in:
Jason Hilder 2026-04-12 09:52:28 +02:00
parent 1d2904460a
commit b280332e9a
2 changed files with 16 additions and 3 deletions

View File

@ -43,7 +43,5 @@ map("n", "gd", ":lua vim.lsp.buf.definition()<CR>")
map("n", "<leader>p", ":b#<CR>")
map("n", "<leader>e", ":Ex<CR>")
map("n", "<leader>c", ":bd<CR>")
map("n", "<leader>1", ":vsplit | vertical resize 95 | terminal<CR>a")
map("n", "<leader>2", ":split | horizontal resize 25 | terminal<CR>a")
require("plugins")

View File

@ -4,7 +4,8 @@ vim.pack.add({
{ src = "https://github.com/neovim/nvim-lspconfig" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
{ src="https://github.com/folke/trouble.nvim" },
{ src="https://github.com/stevearc/oil.nvim" }
{ src="https://github.com/stevearc/oil.nvim" },
{ src="https://github.com/akinsho/toggleterm.nvim" },
})
local map = vim.keymap.set
@ -44,3 +45,17 @@ require("oil").setup({
}
})
map("n", "<leader>e", ":Oil " .. vim.fn.getcwd() .. "<CR>")
require("toggleterm").setup({
open_mapping = [[<C-\>]],
size = function(term)
if term.direction == "horizontal" then
return vim.o.lines * 0.35
elseif term.direction == "vertical" then
return vim.o.columns * 0.35
end
return 15
end,
})
map({"t","n"}, "<C-`>", function() require("toggleterm").toggle(1, nil, nil, "float") end)
map({"t","n"}, "<C-\\>", function() require("toggleterm").toggle(1, nil, nil, "vertical") end)