initial commit, add nvterm files to custom plugins

This commit is contained in:
Alex 2023-10-08 17:00:51 -04:00
parent 0e23601a63
commit 0587595f1e
4 changed files with 64 additions and 8 deletions

View file

@ -0,0 +1,34 @@
return {
"NvChad/nvterm",
config = function()
require("nvterm").setup({
-- Basic Teminal Settings
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 = .3, },
vertical = { location = "rightbelow", split_ratio = .5 },
}
},
behavior = {
autoclose_on_quit = {
enabled = false,
confirm = true,
},
close_on_exit = true,
auto_insert = true,
},
-- Additional Functionality
require "nvterm_config.lua"
})
end,
}

View file

@ -0,0 +1,21 @@
require("nvterm").setup()
local terminal = require("nvterm.terminal")
local ft_cmds = {
python = "python3 " .. vim.fn.expand('%'),
...
--<your commands here>
}
local toggle_modes = { 'n', 't' }
local mappings = {
{ 'n', '<C-l>', function() terminal.send(ft_cmds[vim.bo.filetype]) end },
{ toggle_modes, '<A-h>', function() terminal.toggle('horizontal') end },
{ toggle_modes, '<A-v>', function() terminal.toggle('vertical') end },
{ toggle_modes, '<A-i>', function() terminal.toggle('float') end },
}
local opts = { noremap = true, silent = true }
for _, mapping in ipairs(mappings) do
vim.keymap.set(mapping[1], mapping[2], mapping[3], opts)
end