current good
This commit is contained in:
65
lua/custom/plugins/toggleterm.lua
Normal file
65
lua/custom/plugins/toggleterm.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
-- ============================================================
|
||||
-- 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,
|
||||
})
|
||||
Reference in New Issue
Block a user