From b66e4efa7caae614335c694275133ef42384a98a Mon Sep 17 00:00:00 2001 From: Nicholas Moore Date: Tue, 13 May 2025 16:59:19 -0500 Subject: Refactor neovim config into multiple files --- nvim/lua/custom/plugins/filetypes.lua | 15 +++++++++++++ nvim/lua/custom/plugins/harppon.lua | 37 +++++++++++++++++++++++++++++++++ nvim/lua/custom/plugins/remap.lua | 5 +++++ nvim/lua/custom/plugins/toggleterm.lua | 21 +++++++++++++++++++ nvim/lua/custom/plugins/vim-be-good.lua | 5 +++++ nvim/lua/custom/plugins/vim-sleuth.lua | 3 +++ nvim/lua/custom/plugins/which-key.lua | 3 +++ 7 files changed, 89 insertions(+) create mode 100644 nvim/lua/custom/plugins/filetypes.lua create mode 100644 nvim/lua/custom/plugins/harppon.lua create mode 100644 nvim/lua/custom/plugins/remap.lua create mode 100644 nvim/lua/custom/plugins/toggleterm.lua create mode 100644 nvim/lua/custom/plugins/vim-be-good.lua create mode 100644 nvim/lua/custom/plugins/vim-sleuth.lua create mode 100644 nvim/lua/custom/plugins/which-key.lua (limited to 'nvim/lua/custom') diff --git a/nvim/lua/custom/plugins/filetypes.lua b/nvim/lua/custom/plugins/filetypes.lua new file mode 100644 index 0000000..73c99f2 --- /dev/null +++ b/nvim/lua/custom/plugins/filetypes.lua @@ -0,0 +1,15 @@ +return { + vim.filetype.add { + extension = { + yml = 'yaml.ansible', + }, + }, + + vim.filetype.add { + extension = { + jinja = 'jinja', + jinja2 = 'jinja', + j2 = 'jinja', + }, + }, +} diff --git a/nvim/lua/custom/plugins/harppon.lua b/nvim/lua/custom/plugins/harppon.lua new file mode 100644 index 0000000..1fc29bb --- /dev/null +++ b/nvim/lua/custom/plugins/harppon.lua @@ -0,0 +1,37 @@ +return { + { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require 'harpoon' + harpoon:setup() + vim.keymap.set('n', 'a', function() + harpoon:list():add() + end) + vim.keymap.set('n', '', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end) + vim.keymap.set('n', '1', function() + harpoon:list():select(1) + end) + vim.keymap.set('n', '2', function() + harpoon:list():select(2) + end) + vim.keymap.set('n', '3', function() + harpoon:list():select(3) + end) + vim.keymap.set('n', '4', function() + harpoon:list():select(4) + end) + + -- Toggle previous & next buffers stored within Harpoon list + vim.keymap.set('n', '', function() + harpoon:list():prev() + end) + vim.keymap.set('n', '', function() + harpoon:list():next() + end) + end, + }, +} diff --git a/nvim/lua/custom/plugins/remap.lua b/nvim/lua/custom/plugins/remap.lua new file mode 100644 index 0000000..367d21c --- /dev/null +++ b/nvim/lua/custom/plugins/remap.lua @@ -0,0 +1,5 @@ +return { + -- Scroll by half page and keep cursor in middle + vim.keymap.set('n', '', 'zz'), + vim.keymap.set('n', '', 'zz'), +} diff --git a/nvim/lua/custom/plugins/toggleterm.lua b/nvim/lua/custom/plugins/toggleterm.lua new file mode 100644 index 0000000..cc40f75 --- /dev/null +++ b/nvim/lua/custom/plugins/toggleterm.lua @@ -0,0 +1,21 @@ +return { + { + 'akinsho/toggleterm.nvim', + version = '*', + opts = { + start_in_insert = false, + persistent_mode = true, + shell = vim.o.shell, + auto_scroll = true, + + -- Float options + float_opts = { + border = 'single', + title_pos = 'center', + }, + + -- Bindings + vim.keymap.set('n', '`', ':ToggleTerm direction=float', { desc = 'Open a floating terminal' }), + }, + }, +} diff --git a/nvim/lua/custom/plugins/vim-be-good.lua b/nvim/lua/custom/plugins/vim-be-good.lua new file mode 100644 index 0000000..7e5c709 --- /dev/null +++ b/nvim/lua/custom/plugins/vim-be-good.lua @@ -0,0 +1,5 @@ +return { + { + 'ThePrimeagen/vim-be-good', + }, +} diff --git a/nvim/lua/custom/plugins/vim-sleuth.lua b/nvim/lua/custom/plugins/vim-sleuth.lua new file mode 100644 index 0000000..123ac6a --- /dev/null +++ b/nvim/lua/custom/plugins/vim-sleuth.lua @@ -0,0 +1,3 @@ +return { + { 'tpope/vim-sleuth' }, -- Detect tabstop and shiftwidth automatically +} diff --git a/nvim/lua/custom/plugins/which-key.lua b/nvim/lua/custom/plugins/which-key.lua new file mode 100644 index 0000000..1f73adc --- /dev/null +++ b/nvim/lua/custom/plugins/which-key.lua @@ -0,0 +1,3 @@ +return { + -- { 'folke/which-key.nvim' }, +} -- cgit v1.3