From 0587595f1eb7527ea970a404c995422dbc62c727 Mon Sep 17 00:00:00 2001 From: Alex <25597637+alexvoelker@users.noreply.github.com> Date: Sun, 8 Oct 2023 17:00:51 -0400 Subject: [PATCH] initial commit, add nvterm files to custom plugins --- init.lua | 10 ++++---- lazy-lock.json | 7 +++--- lua/custom/plugins/nvterm.lua | 34 ++++++++++++++++++++++++++++ lua/custom/plugins/nvterm_config.lua | 21 +++++++++++++++++ 4 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 lua/custom/plugins/nvterm.lua create mode 100644 lua/custom/plugins/nvterm_config.lua diff --git a/init.lua b/init.lua index 7dd4ea9e..51be2b65 100644 --- a/init.lua +++ b/init.lua @@ -110,7 +110,7 @@ require('lazy').setup({ }, -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, + { 'folke/which-key.nvim', opts = {} }, { -- Adds git related signs to the gutter, as well as utilities for managing changes 'lewis6991/gitsigns.nvim', @@ -472,12 +472,12 @@ require('mason-lspconfig').setup() -- If you want to override the default filetypes that your language server will attach to you can -- define the property 'filetypes' to the map in question. local servers = { - -- clangd = {}, + clangd = {}, -- gopls = {}, - pyright = { filetypes = {'py'} }, - -- rust_analyzer = {}, + pyright = { filetypes = { 'py' } }, + rust_analyzer = {}, -- tsserver = {}, - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, + html = { filetypes = { 'html', 'twig', 'hbs' } }, lua_ls = { Lua = { diff --git a/lazy-lock.json b/lazy-lock.json index 2255968c..a0fb5bd9 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -7,12 +7,12 @@ "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, "gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" }, "indent-blankline.nvim": { "branch": "master", "commit": "877c1db2bf957300097dd5348a665666a4d900cb" }, - "lazy.nvim": { "branch": "main", "commit": "62745a7320f48a00ac4f7b0591352608cbc6bcea" }, + "lazy.nvim": { "branch": "main", "commit": "f0cfbf995238a42064e119bd1daa694fd1683ea3" }, "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e2705063f395b44f676cd26596a11007a2cbd3bd" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "6148b51db945b55b3b725da39eaea6441e59dff8" }, "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, - "neo-tree.nvim": { "branch": "main", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" }, + "neo-tree.nvim": { "branch": "main", "commit": "6f8c49956c89e9fefae6acdfe1d57c6293b0a03d" }, "neodev.nvim": { "branch": "main", "commit": "f8592cc143a5512b98a2c3683aa43c73f98e34f7" }, "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, @@ -20,9 +20,10 @@ "nvim-dap-go": { "branch": "main", "commit": "a5cc8dcad43f0732585d4793deb02a25c4afb766" }, "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, "nvim-lspconfig": { "branch": "master", "commit": "2b361e043810d5587d9af0787f8ce40da92ec5e9" }, - "nvim-treesitter": { "branch": "master", "commit": "957f3f8c15a88ef0f0c77ecd13edf2e2578f176e" }, + "nvim-treesitter": { "branch": "master", "commit": "a102053352bd958d84a3e1be3de0203d2af92984" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "76c7a89b41de77a4f83fb77fa072c5ad7605fe3b" }, "nvim-web-devicons": { "branch": "master", "commit": "56b3a6ce6d69329cbf603dd38ac59fb4d7774b01" }, + "nvterm": { "branch": "main", "commit": "3e43be1d0ca60cc5e2dfc2d289b06577e7e57e98" }, "onedark.nvim": { "branch": "master", "commit": "826fb77e9ca92d3c0f3d937328663d4a6dc7fee1" }, "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, diff --git a/lua/custom/plugins/nvterm.lua b/lua/custom/plugins/nvterm.lua new file mode 100644 index 00000000..c66cc5a3 --- /dev/null +++ b/lua/custom/plugins/nvterm.lua @@ -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, +} diff --git a/lua/custom/plugins/nvterm_config.lua b/lua/custom/plugins/nvterm_config.lua new file mode 100644 index 00000000..6c37be43 --- /dev/null +++ b/lua/custom/plugins/nvterm_config.lua @@ -0,0 +1,21 @@ +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 +