Files
nvim-config/lua/custom/plugins/toggleterm.lua

66 lines
1.3 KiB
Lua
Raw Normal View History

2026-05-20 09:39:20 -06:00
-- ============================================================
-- TOGGLETERM
-- Floating terminal
-- ============================================================
vim.pack.add {
{
src = 'https://github.com/akinsho/toggleterm.nvim',
version = vim.version.range '*',
},
}
require('toggleterm').setup {
size = 20,
open_mapping = [[<leader>tt]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
start_in_insert = true,
insert_mappings = true,
terminal_mappings = true,
persist_size = true,
persist_mode = true,
direction = 'float',
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = 'rounded',
winblend = 0,
},
}
-- ============================================================
-- TERMINAL KEYMAPS
-- ============================================================
vim.api.nvim_create_autocmd('TermOpen', {
pattern = 'term://*',
callback = function()
local opts = { buffer = 0 }
-- ESC exits terminal insert mode
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]], opts)
-- Better window navigation
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
end,
})