From 21eedfd6e7a3d7ef42e15766ee908ec8a57bf187 Mon Sep 17 00:00:00 2001 From: Alex <25597637+alexvoelker@users.noreply.github.com> Date: Sun, 8 Oct 2023 20:09:49 -0400 Subject: [PATCH] edit nvterm config setup --- init.lua | 20 ++++++++++++++++++++ lua/custom/plugins/nvterm.lua | 2 -- lua/custom/plugins/nvterm_config.lua | 21 --------------------- 3 files changed, 20 insertions(+), 23 deletions(-) delete mode 100644 lua/custom/plugins/nvterm_config.lua diff --git a/init.lua b/init.lua index 51be2b65..d97e6333 100644 --- a/init.lua +++ b/init.lua @@ -230,6 +230,26 @@ require('lazy').setup({ { 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('%'), + ... + -- +} +local toggle_modes = { 'n', 't' } +local mappings = { + { 'n', '', function() terminal.send(ft_cmds[vim.bo.filetype]) end }, + { toggle_modes, '', function() terminal.toggle('horizontal') end }, + { toggle_modes, '', function() terminal.toggle('vertical') end }, + { toggle_modes, '', 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 ]] -- See `:help vim.o` -- NOTE: You can change these options as you wish! diff --git a/lua/custom/plugins/nvterm.lua b/lua/custom/plugins/nvterm.lua index c66cc5a3..acf81740 100644 --- a/lua/custom/plugins/nvterm.lua +++ b/lua/custom/plugins/nvterm.lua @@ -27,8 +27,6 @@ return { close_on_exit = true, auto_insert = true, }, - -- Additional Functionality - require "nvterm_config.lua" }) end, } diff --git a/lua/custom/plugins/nvterm_config.lua b/lua/custom/plugins/nvterm_config.lua deleted file mode 100644 index 6c37be43..00000000 --- a/lua/custom/plugins/nvterm_config.lua +++ /dev/null @@ -1,21 +0,0 @@ -require("nvterm").setup() - -local terminal = require("nvterm.terminal") - -local ft_cmds = { - python = "python3 " .. vim.fn.expand('%'), - ... - -- -} -local toggle_modes = { 'n', 't' } -local mappings = { - { 'n', '', function() terminal.send(ft_cmds[vim.bo.filetype]) end }, - { toggle_modes, '', function() terminal.toggle('horizontal') end }, - { toggle_modes, '', function() terminal.toggle('vertical') end }, - { toggle_modes, '', 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 -