diff --git a/common/.config/nvim/lua/plugins/coding-cmp.lua b/common/.config/nvim/lua/plugins/code-completion.lua similarity index 90% rename from common/.config/nvim/lua/plugins/coding-cmp.lua rename to common/.config/nvim/lua/plugins/code-completion.lua index 097f464..77895b4 100644 --- a/common/.config/nvim/lua/plugins/coding-cmp.lua +++ b/common/.config/nvim/lua/plugins/code-completion.lua @@ -74,15 +74,15 @@ return { { "L3MON4D3/LuaSnip", keys = { - { - "", - function() - return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" - end, - expr = true, - silent = true, - mode = "i", - }, + -- { + -- "", + -- function() + -- return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" + -- end, + -- expr = true, + -- silent = true, + -- mode = "i", + -- }, { "", function() diff --git a/common/.config/nvim/lua/plugins/coding-debug.lua b/common/.config/nvim/lua/plugins/code-debug.lua similarity index 100% rename from common/.config/nvim/lua/plugins/coding-debug.lua rename to common/.config/nvim/lua/plugins/code-debug.lua diff --git a/common/.config/nvim/lua/plugins/coding-formatting.lua b/common/.config/nvim/lua/plugins/code-formatting.lua similarity index 100% rename from common/.config/nvim/lua/plugins/coding-formatting.lua rename to common/.config/nvim/lua/plugins/code-formatting.lua diff --git a/common/.config/nvim/lua/plugins/coding-generic.lua b/common/.config/nvim/lua/plugins/code-generic.lua similarity index 79% rename from common/.config/nvim/lua/plugins/coding-generic.lua rename to common/.config/nvim/lua/plugins/code-generic.lua index a1a95e8..ab1e05e 100644 --- a/common/.config/nvim/lua/plugins/coding-generic.lua +++ b/common/.config/nvim/lua/plugins/code-generic.lua @@ -1,4 +1,6 @@ return { + { "tpope/vim-repeat" }, + -- Better surround than tpope/vim-surround { "kylechui/nvim-surround", @@ -28,6 +30,54 @@ return { opts = {}, }, + -- indent guides for Neovim + { + "lukas-reineke/indent-blankline.nvim", + opts = { + indent = { char = "│", tab_char = "│" }, + scope = { enabled = false }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }, + }, + main = "ibl", + }, + + -- Highlights the current level of indentation, and animates the highlighting. + { + "echasnovski/mini.indentscope", + opts = { symbol = "│", options = { try_as_border = true } }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "help", + "neo-tree", + "Trouble", + "trouble", + "lazy", + "mason", + "notify", + "toggleterm", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + end, + }, + -- Finds and lists all of the TODO, HACK, BUG, etc comment { "folke/todo-comments.nvim", diff --git a/common/.config/nvim/lua/plugins/coding-git.lua b/common/.config/nvim/lua/plugins/code-git.lua similarity index 97% rename from common/.config/nvim/lua/plugins/coding-git.lua rename to common/.config/nvim/lua/plugins/code-git.lua index 3776912..d443d25 100644 --- a/common/.config/nvim/lua/plugins/coding-git.lua +++ b/common/.config/nvim/lua/plugins/code-git.lua @@ -1,10 +1,9 @@ return { - { "tpope/vim-fugitive" }, --{ "tpope/vim-rhubarb" }, --If fugitive.vim is the Git, rhubarb.vim is the Hub. + -- Adds git related signs to the gutter, as well as utilities for managing changes { - -- Adds git related signs to the gutter, as well as utilities for managing changes "lewis6991/gitsigns.nvim", opts = { -- See `:help gitsigns.txt` diff --git a/common/.config/nvim/lua/plugins/coding-lint.lua b/common/.config/nvim/lua/plugins/code-lint.lua similarity index 100% rename from common/.config/nvim/lua/plugins/coding-lint.lua rename to common/.config/nvim/lua/plugins/code-lint.lua diff --git a/common/.config/nvim/lua/plugins/coding-lsp.lua b/common/.config/nvim/lua/plugins/code-lsp.lua similarity index 100% rename from common/.config/nvim/lua/plugins/coding-lsp.lua rename to common/.config/nvim/lua/plugins/code-lsp.lua diff --git a/common/.config/nvim/lua/plugins/coding-reactjs.lua b/common/.config/nvim/lua/plugins/code-reactjs.lua similarity index 100% rename from common/.config/nvim/lua/plugins/coding-reactjs.lua rename to common/.config/nvim/lua/plugins/code-reactjs.lua diff --git a/common/.config/nvim/lua/plugins/coding-test.lua b/common/.config/nvim/lua/plugins/code-testing.lua similarity index 100% rename from common/.config/nvim/lua/plugins/coding-test.lua rename to common/.config/nvim/lua/plugins/code-testing.lua diff --git a/common/.config/nvim/lua/plugins/colorthemes.lua b/common/.config/nvim/lua/plugins/colorthemes.lua deleted file mode 100644 index c03770b..0000000 --- a/common/.config/nvim/lua/plugins/colorthemes.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - { - "projekt0n/github-nvim-theme", - lazy = false, - priority = 1000, - config = function() - vim.cmd("colorscheme github_dark_dimmed") - end, - }, -} diff --git a/common/.config/nvim/lua/plugins/treesitter.lua b/common/.config/nvim/lua/plugins/navigate-code.lua similarity index 82% rename from common/.config/nvim/lua/plugins/treesitter.lua rename to common/.config/nvim/lua/plugins/navigate-code.lua index 8194c43..432aec5 100644 --- a/common/.config/nvim/lua/plugins/treesitter.lua +++ b/common/.config/nvim/lua/plugins/navigate-code.lua @@ -1,4 +1,47 @@ return { + { "easymotion/vim-easymotion" }, + { "unblevable/quick-scope" }, + + -- Automatically highlights other instances of the word under cursor + { + "RRethy/vim-illuminate", + lazy = false, + opts = { + delay = 200, + large_file_cutoff = 2000, + large_file_override = { + providers = { "lsp" }, + }, + }, + config = function(_, opts) + -- Copied from LazyNvim + require("illuminate").configure(opts) + + local function map(key, dir, buffer) + vim.keymap.set("n", key, function() + require("illuminate")["goto_" .. dir .. "_reference"](false) + end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer }) + end + + map("]]", "next") + map("[[", "prev") + + -- also set it after loading ftplugins, since a lot overwrite [[ and ]] + vim.api.nvim_create_autocmd("FileType", { + callback = function() + local buffer = vim.api.nvim_get_current_buf() + map("]]", "next", buffer) + map("[[", "prev", buffer) + end, + }) + end, + keys = { + { "]]", desc = "Next Reference" }, + { "[[", desc = "Prev Reference" }, + }, + }, + + -- Treesitter { -- nvim-treesitter provides parsers for individual languages -- Output of these parses are fed to the NVIM's native treesitter(vim.treesitter) @@ -29,8 +72,7 @@ return { if name:find("goto") == 1 then move[name] = function(q, ...) if vim.wo.diff then - local config = configs.get_module("textobjects.move") - [name] ---@type table + local config = configs.get_module("textobjects.move")[name] ---@type table for key, query in pairs(config or {}) do if q == query and key:find("[%]%[][cC]") then vim.cmd("normal! " .. key) diff --git a/common/.config/nvim/lua/plugins/telescope.lua b/common/.config/nvim/lua/plugins/navigate-files.lua similarity index 63% rename from common/.config/nvim/lua/plugins/telescope.lua rename to common/.config/nvim/lua/plugins/navigate-files.lua index d3b1913..23c5cf0 100644 --- a/common/.config/nvim/lua/plugins/telescope.lua +++ b/common/.config/nvim/lua/plugins/navigate-files.lua @@ -1,4 +1,96 @@ return { + -- File Explorer + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + keys = { + { "e", ":Neotree filesystem toggle", desc = "Open NeoTree [E]plorer at Git root", remap = true }, + + { + "be", + function() + require("neo-tree.command").execute({ source = "buffers", toggle = true }) + end, + desc = "NeoTree: Open [B]buffer [E]xplorer", + }, + }, + deactivate = function() + vim.cmd([[Neotree close]]) + end, + init = function() + if vim.fn.argc(-1) == 1 then + local stat = vim.loop.fs_stat(vim.fn.argv(0)) + if stat and stat.type == "directory" then + require("neo-tree") + end + end + end, + opts = { + enable_git_status = true, + filesystem = { + bind_to_cwd = true, + follow_current_file = { + enabled = true, -- Highlight the current buffer + leave_dirs_open = false, + }, + use_libuv_file_watcher = true, -- Sync file system changes + filtered_items = { + visible = true, + show_hidden_count = true, + hide_dotfile = false, + hide_gitignore = false, + }, + }, + window = { + position = "left", + width = 30, -- Saner window size + mappings = { + ["s"] = "open_split", -- horizontal split + ["v"] = "open_vsplit", -- vertical split + ["Y"] = function(state) -- Copy file's path to + register + local node = state.tree:get_node() + local path = node:get_id() + vim.fn.setreg("+", path, "c") + end, + }, + }, + default_component_configs = { + indent = { + indent_size = 2, -- Compact tree display + with_expanders = true, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + }, + sources = { "filesystem", "buffers", "git_status", "document_symbols" }, + open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, + }, + config = function(_, opts) + local config = require("config.util") + + local function on_move(data) + config.on_rename(data.source, data.destination) + end + + local events = require("neo-tree.events") + opts.event_handlers = opts.event_handlers or {} + vim.list_extend(opts.event_handlers, { + { event = events.FILE_MOVED, handler = on_move }, + { event = events.FILE_RENAMED, handler = on_move }, + }) + require("neo-tree").setup(opts) + vim.api.nvim_create_autocmd("TermClose", { + pattern = "*lazygit", + callback = function() + if package.loaded["neo-tree.sources.git_status"] then + require("neo-tree.sources.git_status").refresh() + end + end, + }) + end, + }, + -- Fuzzy Finder (files, lsp, etc) { "nvim-telescope/telescope.nvim", diff --git a/common/.config/nvim/lua/plugins/editor.lua b/common/.config/nvim/lua/plugins/ui.lua similarity index 61% rename from common/.config/nvim/lua/plugins/editor.lua rename to common/.config/nvim/lua/plugins/ui.lua index dc986a7..a053056 100644 --- a/common/.config/nvim/lua/plugins/editor.lua +++ b/common/.config/nvim/lua/plugins/ui.lua @@ -1,203 +1,23 @@ return { + -- icons + { "nvim-tree/nvim-web-devicons" }, + + -- ui components + { "MunifTanjim/nui.nvim" }, + + -- Better vim.ui + { "stevearc/dressing.nvim" }, - { "tpope/vim-repeat" }, - { "easymotion/vim-easymotion" }, { "machakann/vim-highlightedyank" }, - { "unblevable/quick-scope" }, - -- Changes the Nvim root to git root + -- colorscheme { - "airblade/vim-rooter", - config = function() - vim.g.rooter_cd_cmd = "tcd" -- Use tcd command to change the root - end, - }, - - -- indent guides for Neovim - { - "lukas-reineke/indent-blankline.nvim", - opts = { - indent = { char = "│", tab_char = "│" }, - scope = { enabled = false }, - exclude = { - filetypes = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", - }, - }, - }, - main = "ibl", - }, - - -- Highlights the current level of indentation, and animates the highlighting. - { - "echasnovski/mini.indentscope", - opts = { symbol = "│", options = { try_as_border = true } }, - init = function() - vim.api.nvim_create_autocmd("FileType", { - pattern = { - "help", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - }, - callback = function() - vim.b.miniindentscope_disable = true - end, - }) - end, - }, - - -- File Explorer - { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - keys = { - { "e", ":Neotree filesystem toggle", desc = "Open NeoTree [E]plorer at Git root", remap = true }, - - { - "be", - function() - require("neo-tree.command").execute({ source = "buffers", toggle = true }) - end, - desc = "NeoTree: Open [B]buffer [E]xplorer", - }, - }, - deactivate = function() - vim.cmd([[Neotree close]]) - end, - init = function() - if vim.fn.argc(-1) == 1 then - local stat = vim.loop.fs_stat(vim.fn.argv(0)) - if stat and stat.type == "directory" then - require("neo-tree") - end - end - end, - opts = { - enable_git_status = true, - filesystem = { - bind_to_cwd = true, - follow_current_file = { - enabled = true, -- Highlight the current buffer - leave_dirs_open = false, - }, - use_libuv_file_watcher = true, -- Sync file system changes - filtered_items = { - visible = true, - show_hidden_count = true, - hide_dotfile = false, - hide_gitignore = false, - }, - }, - window = { - position = "left", - width = 30, -- Saner window size - mappings = { - ["s"] = "open_split", -- horizontal split - ["v"] = "open_vsplit", -- vertical split - ["Y"] = function(state) -- Copy file's path to + register - local node = state.tree:get_node() - local path = node:get_id() - vim.fn.setreg("+", path, "c") - end, - }, - }, - default_component_configs = { - indent = { - indent_size = 2, -- Compact tree display - with_expanders = true, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - }, - sources = { "filesystem", "buffers", "git_status", "document_symbols" }, - open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, - }, - config = function(_, opts) - local config = require("config.util") - - local function on_move(data) - config.on_rename(data.source, data.destination) - end - - local events = require("neo-tree.events") - opts.event_handlers = opts.event_handlers or {} - vim.list_extend(opts.event_handlers, { - { event = events.FILE_MOVED, handler = on_move }, - { event = events.FILE_RENAMED, handler = on_move }, - }) - require("neo-tree").setup(opts) - vim.api.nvim_create_autocmd("TermClose", { - pattern = "*lazygit", - callback = function() - if package.loaded["neo-tree.sources.git_status"] then - require("neo-tree.sources.git_status").refresh() - end - end, - }) - end, - }, - - -- Automatically highlights other instances of the word under cursor - { - "RRethy/vim-illuminate", + "projekt0n/github-nvim-theme", lazy = false, - opts = { - delay = 200, - large_file_cutoff = 2000, - large_file_override = { - providers = { "lsp" }, - }, - }, - config = function(_, opts) - -- Copied from LazyNvim - require("illuminate").configure(opts) - - local function map(key, dir, buffer) - vim.keymap.set("n", key, function() - require("illuminate")["goto_" .. dir .. "_reference"](false) - end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer }) - end - - map("]]", "next") - map("[[", "prev") - - -- also set it after loading ftplugins, since a lot overwrite [[ and ]] - vim.api.nvim_create_autocmd("FileType", { - callback = function() - local buffer = vim.api.nvim_get_current_buf() - map("]]", "next", buffer) - map("[[", "prev", buffer) - end, - }) + priority = 1000, + config = function() + vim.cmd("colorscheme github_dark_dimmed") end, - keys = { - { "]]", desc = "Next Reference" }, - { "[[", desc = "Prev Reference" }, - }, - }, - - -- Display undotree - { - "mbbill/undotree", - keys = { - { "u", "UndotreeToggle", desc = "Toggle Undotree panel" }, - }, }, -- Show buffers like VS Code tabs @@ -246,17 +66,6 @@ return { end, }, - -- UI Stuff ------------------------------------------------------------------------ - - -- icons - { "nvim-tree/nvim-web-devicons" }, - - -- ui components - { "MunifTanjim/nui.nvim" }, - - -- Better vim.ui - { "stevearc/dressing.nvim" }, - -- Better `vim.notify()` { "rcarriga/nvim-notify", diff --git a/common/.config/nvim/lua/plugins/utility-plugs.lua b/common/.config/nvim/lua/plugins/utility-plugs.lua index dd96df3..73448fe 100644 --- a/common/.config/nvim/lua/plugins/utility-plugs.lua +++ b/common/.config/nvim/lua/plugins/utility-plugs.lua @@ -25,6 +25,22 @@ return { end, }, + -- Changes the Nvim root to git root + { + "airblade/vim-rooter", + config = function() + vim.g.rooter_cd_cmd = "tcd" -- Use tcd command to change the root + end, + }, + + -- Display undotree + { + "mbbill/undotree", + keys = { + { "u", "UndotreeToggle", desc = "Toggle Undotree panel" }, + }, + }, + { "folke/which-key.nvim", config = function()