edit nvterm config setup

This commit is contained in:
Alex 2023-10-08 20:09:49 -04:00
parent 0587595f1e
commit 21eedfd6e7
3 changed files with 20 additions and 23 deletions

View File

@ -230,6 +230,26 @@ require('lazy').setup({
{ import = 'custom.plugins' }, { import = 'custom.plugins' },
}, {}) }, {})
-- nvterm initalization code, the rest is in custom/plugins/nvterm.lua
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
-- [[ Setting options ]] -- [[ Setting options ]]
-- See `:help vim.o` -- See `:help vim.o`
-- NOTE: You can change these options as you wish! -- NOTE: You can change these options as you wish!

View File

@ -27,8 +27,6 @@ return {
close_on_exit = true, close_on_exit = true,
auto_insert = true, auto_insert = true,
}, },
-- Additional Functionality
require "nvterm_config.lua"
}) })
end, end,
} }

View File

@ -1,21 +0,0 @@
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