-- Dev core -- Plugins that are just there. -- Sections: -- ## TREE SITTER -- -> nvim-treesitter [syntax highlight] -- -> render-markdown.nvim [normal mode markdown] -- -> nvim-highlight-colors [hex colors] -- ## LSP -- -> nvim-java [java support] -- -> mason-lspconfig [auto start lsp] -- -> nvim-lspconfig [lsp configs] -- -> mason.nvim [lsp package manager] -- -> none-ls-autoload.nvim [mason package loader] -- -> none-ls [lsp code formatting] -- -> garbage-day [lsp garbage collector] -- -> lazydev [lua lsp for nvim plugins] -- ## AUTO COMPLETION -- -> nvim-cmp [auto completion engine] -- -> cmp-nvim-buffer [auto completion buffer] -- -> cmp-nvim-path [auto completion path] -- -> cmp-nvim-lsp [auto completion lsp] -- -> cmp-luasnip [auto completion snippets] -- -> cmp-copilot [auto completion copilot] local utils = require("base.utils") return { -- TREE SITTER --------------------------------------------------------- -- [syntax highlight] -- https://github.com/nvim-treesitter/nvim-treesitter -- https://github.com/windwp/nvim-treesitter-textobjects { "nvim-treesitter/nvim-treesitter", dependencies = { "nvim-treesitter/nvim-treesitter-textobjects" }, event = "User BaseDefered", cmd = { "TSBufDisable", "TSBufEnable", "TSBufToggle", "TSDisable", "TSEnable", "TSToggle", "TSInstall", "TSInstallInfo", "TSInstallSync", "TSModuleInfo", "TSUninstall", "TSUpdate", "TSUpdateSync", }, build = ":TSUpdate", opts = { auto_install = false, -- Currently bugged. Use [:TSInstall all] and [:TSUpdate all] highlight = { enable = true, disable = function(_, bufnr) return utils.is_big_file(bufnr) end, }, matchup = { enable = true, enable_quotes = true, disable = function(_, bufnr) return utils.is_big_file(bufnr) end, }, incremental_selection = { enable = true }, indent = { enable = true }, textobjects = { select = { enable = true, lookahead = true, keymaps = { ["ak"] = { query = "@block.outer", desc = "around block" }, ["ik"] = { query = "@block.inner", desc = "inside block" }, ["ac"] = { query = "@class.outer", desc = "around class" }, ["ic"] = { query = "@class.inner", desc = "inside class" }, ["a?"] = { query = "@conditional.outer", desc = "around conditional" }, ["i?"] = { query = "@conditional.inner", desc = "inside conditional" }, ["af"] = { query = "@function.outer", desc = "around function " }, ["if"] = { query = "@function.inner", desc = "inside function " }, ["al"] = { query = "@loop.outer", desc = "around loop" }, ["il"] = { query = "@loop.inner", desc = "inside loop" }, ["aa"] = { query = "@parameter.outer", desc = "around argument" }, ["ia"] = { query = "@parameter.inner", desc = "inside argument" }, }, }, move = { enable = true, set_jumps = true, goto_next_start = { ["]k"] = { query = "@block.outer", desc = "Next block start" }, ["]f"] = { query = "@function.outer", desc = "Next function start" }, ["]a"] = { query = "@parameter.inner", desc = "Next parameter start" }, }, goto_next_end = { ["]K"] = { query = "@block.outer", desc = "Next block end" }, ["]F"] = { query = "@function.outer", desc = "Next function end" }, ["]A"] = { query = "@parameter.inner", desc = "Next parameter end" }, }, goto_previous_start = { ["[k"] = { query = "@block.outer", desc = "Previous block start" }, ["[f"] = { query = "@function.outer", desc = "Previous function start" }, ["[a"] = { query = "@parameter.inner", desc = "Previous parameter start" }, }, goto_previous_end = { ["[K"] = { query = "@block.outer", desc = "Previous block end" }, ["[F"] = { query = "@function.outer", desc = "Previous function end" }, ["[A"] = { query = "@parameter.inner", desc = "Previous parameter end" }, }, }, swap = { enable = true, swap_next = { [">K"] = { query = "@block.outer", desc = "Swap next block" }, [">F"] = { query = "@function.outer", desc = "Swap next function" }, [">A"] = { query = "@parameter.inner", desc = "Swap next parameter" }, }, swap_previous = { [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select, count = 8, }, [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select, count = 8, }, [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select, count = 16, }, [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select, count = 16, }, [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select, count = 16, }, [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select, count = 16, }, [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select, }, [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select, }, [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert, }, [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert, }, [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert, }, [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert, }, [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), [""] = cmp.config.disable, [""] = cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close(), }, [""] = cmp.mapping.confirm { select = false }, [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif has_words_before() then cmp.complete() else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, { "i", "s" }), }, sources = cmp.config.sources { -- Note: Priority decides the order items appear. { name = "nvim_lsp", priority = 1000 }, { name = "lazydev", priority = 850 }, { name = "luasnip", priority = 750 }, { name = "copilot", priority = 600 }, { name = "buffer", priority = 500 }, { name = "path", priority = 250 }, }, } end, }, }