diff --git a/init.lua b/init.lua index 515adf9..dfe497a 100644 --- a/init.lua +++ b/init.lua @@ -24,6 +24,8 @@ vim.keymap.set("n", "", "bdelete", { silent = true }) vim.g.mapleader = " " vim.g.maplocalleader = " " +full_feature = false + -- Use lazy.nvim as plugin manager, and load plugin's config local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then diff --git a/lua/plugins/10-editor.lua b/lua/plugins/10-editor.lua index c3dc0ce..d337fc2 100644 --- a/lua/plugins/10-editor.lua +++ b/lua/plugins/10-editor.lua @@ -9,6 +9,7 @@ return { }, { "karb94/neoscroll.nvim", + enabled = full_feature, main = "neoscroll", opts = { }, }, @@ -22,6 +23,7 @@ return { }, { "akinsho/bufferline.nvim", + enabled = full_feature, main = "bufferline", opts = { options = { @@ -45,6 +47,7 @@ return { }, { "nvim-lualine/lualine.nvim", + enabled = full_feature, dependencies = { "nvim-tree/nvim-web-devicons" }, @@ -56,6 +59,7 @@ return { }, { "nvim-tree/nvim-tree.lua", + enabled = full_feature, dependencies = { "nvim-tree/nvim-web-devicons" }, diff --git a/lua/plugins/20-git.lua b/lua/plugins/20-git.lua index a4c6468..561dd2e 100644 --- a/lua/plugins/20-git.lua +++ b/lua/plugins/20-git.lua @@ -1,6 +1,7 @@ return { "lewis6991/gitsigns.nvim", main = "gitsigns", + enabled = full_feature, opts = { on_attach = function(bufnr) local gs = package.loaded.gitsigns diff --git a/lua/plugins/20-treesitter.lua b/lua/plugins/20-treesitter.lua new file mode 100644 index 0000000..2416874 --- /dev/null +++ b/lua/plugins/20-treesitter.lua @@ -0,0 +1,64 @@ +local full_ensure = { + "bash", + "c", + "cmake", + "cpp", + "css", + "diff", + "dockerfile", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "go", + "gomod", + "gosum", + "html", + "java", + "javascript", + "json", + "json5", + "jsonc", + "lua", + "luadoc", + "luau", + "make", + "markdown", + "markdown_inline", + "python", + "rust", + "scss", + "sql", + "toml", + "vim", + "vimdoc", + "yaml" +} + +local basic_ensure = { + "toml", + "json", + "json5", + "jsonc", + "yaml", +} + +if full_feature then + ensure = full_ensure +else + ensure = basic_ensure +end + +return { + "nvim-treesitter/nvim-treesitter", + main = "nvim-treesitter.configs", + build = ":TSUpdate", + opts = { + indent = { enable = true }, + highlight = { enable = true }, + ensure_installed = ensure, + auto_install = true, + sync_install = false, + }, +} diff --git a/lua/plugins/50-lsp.lua b/lua/plugins/50-lsp.lua index 309fd31..21f3163 100644 --- a/lua/plugins/50-lsp.lua +++ b/lua/plugins/50-lsp.lua @@ -39,6 +39,7 @@ end return { { "neovim/nvim-lspconfig", + enabled = full_feature, dependencies = { "hrsh7th/nvim-cmp", "hrsh7th/cmp-nvim-lsp", diff --git a/lua/plugins/50-treesitter.lua b/lua/plugins/50-treesitter.lua deleted file mode 100644 index 02227a6..0000000 --- a/lua/plugins/50-treesitter.lua +++ /dev/null @@ -1,48 +0,0 @@ -return { - "nvim-treesitter/nvim-treesitter", - main = "nvim-treesitter.configs", - build = ":TSUpdate", - opts = { - indent = { enable = true }, - highlight = { enable = true }, - ensure_installed = { - "bash", - "c", - "cmake", - "cpp", - "css", - "diff", - "dockerfile", - "git_config", - "git_rebase", - "gitattributes", - "gitcommit", - "gitignore", - "go", - "gomod", - "gosum", - "html", - "java", - "javascript", - "json", - "json5", - "jsonc", - "lua", - "luadoc", - "luau", - "make", - "markdown", - "markdown_inline", - "python", - "rust", - "scss", - "sql", - "toml", - "vim", - "vimdoc", - "yaml" - }, - auto_install = true, - sync_install = false, - }, -}