48 lines
1.5 KiB
Lua
48 lines
1.5 KiB
Lua
return {
|
|
'akinsho/toggleterm.nvim',
|
|
version = "*",
|
|
config = function()
|
|
require("toggleterm").setup {
|
|
size = 20,
|
|
open_mapping = [[<c-\>]],
|
|
hide_numbers = true,
|
|
shade_filetypes = {},
|
|
shade_terminals = true,
|
|
shading_factor = 2,
|
|
start_in_insert = true,
|
|
insert_mappings = true,
|
|
persist_size = true,
|
|
direction = "float",
|
|
auto_scroll = true,
|
|
close_on_exit = true,
|
|
shell = vim.o.shell,
|
|
float_opts = {
|
|
border = "curved",
|
|
winblend = 0,
|
|
highlights = {
|
|
border = "Normal",
|
|
background = "Normal",
|
|
},
|
|
},
|
|
}
|
|
function _G.set_terminal_keymaps()
|
|
local opts = { buffer = 0 }
|
|
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
|
|
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
|
|
vim.keymap.set('t', '<C-[>', [[<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-]>', [[<Cmd>wincmd l<CR>]], opts)
|
|
-- vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
|
|
|
|
|
|
-- vim.keymap.set('n', '<Leader>tt', '<Cmd>ToggleTerm<CR>')
|
|
-- vim.keymap.set('n', '<Leader>t1', '<Cmd>1ToggleTerm<CR>')
|
|
-- vim.keymap.set('n', '<Leader>t2', '<Cmd>2ToggleTerm<CR>')
|
|
end
|
|
|
|
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
|
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
|
end
|
|
}
|