added nvchad terminal

This commit is contained in:
Wellinton Aracena 2024-03-03 13:44:22 -05:00
parent 1e0b8c3362
commit f387850d19
1 changed files with 17 additions and 54 deletions

View File

@ -2,65 +2,28 @@ return {
{ {
'NvChad/nvterm', 'NvChad/nvterm',
config = function() config = function()
require('nvterm').setup { require('nvterm').setup()
terminals = {
shell = vim.o.shell,
list = {},
type_opts = {
float = {
relative = 'editor',
row = 0.3,
col = 0.25,
width = 0.5,
height = 0.4,
border = 'single',
},
horizontal = { location = 'rightbelow', split_ratio = 0.3 },
vertical = { location = 'rightbelow', split_ratio = 0.5 },
},
},
behavior = {
autoclose_on_quit = {
enabled = false,
confirm = true,
},
close_on_exit = true,
auto_insert = true,
},
}
end, end,
keys = function() keys = function()
local map = function(modes, keys, func, desc)
vim.keymap.set(modes, keys, func, { noremap = true, silent = true, desc = 'spawns terminal: ' .. desc })
end
require('nvterm').setup() require('nvterm').setup()
local terminal = require 'nvterm.terminal' local terminal = require 'nvterm.terminal'
local toggle_modes = { 'n', 't' } local toggle_modes = { 'n', 't' }
local mappings = {
{ map(toggle_modes, '<leader>th', function()
toggle_modes,
'<leader>th',
function()
terminal.toggle 'horizontal' terminal.toggle 'horizontal'
Desc = '[S]earch [H]elp' end, 'horizontal')
end,
}, map(toggle_modes, '<leader>tv', function()
{
toggle_modes,
'<leader>tv',
function()
terminal.toggle 'vertical' terminal.toggle 'vertical'
end, end, 'vertical')
},
{ map(toggle_modes, '<leader>ti', function()
toggle_modes,
'<leader>ti',
function()
terminal.toggle 'float' terminal.toggle 'float'
end, end, 'floating')
},
}
local opts = { noremap = true, silent = true }
for _, mapping in ipairs(mappings) do
vim.keymap.set(mapping[1], mapping[2], mapping[3], opts)
end
end, end,
}, },
} }