diff --git a/nvim/lua/darcula/plugins.lua b/nvim/lua/darcula/plugins.lua index b69f284..fef416e 100644 --- a/nvim/lua/darcula/plugins.lua +++ b/nvim/lua/darcula/plugins.lua @@ -57,9 +57,38 @@ vim.api.nvim_create_autocmd( } ) -vim.pack.add( +local packages = { + {src = "https://github.com/nvim-lua/plenary.nvim"}, + {src = "https://github.com/rktjmp/lush.nvim"}, + {src = "https://git.fifthgrid.com/sgraves/darcula_lush"} +} + +if NV_DARCULA_ENABLE_COC then + vim.list_extend( + packages, + { + {src = "https://github.com/neoclide/coc.nvim", {version = "release"}}, + {src = "https://github.com/fannheyward/telescope-coc.nvim"}, + {src = "https://github.com/honza/vim-snippets"} + } + ) +else + vim.list_extend( + packages, + { + {src = "https://github.com/neovim/nvim-lspconfig"}, + {src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim"}, + {src = "https://github.com/akinsho/flutter-tools.nvim"}, + {src = "https://github.com/kosayoda/nvim-lightbulb"}, + {src = "https://github.com/mason-org/mason-lspconfig.nvim"}, + {src = "https://github.com/mason-org/mason.nvim"} + } + ) +end + +vim.list_extend( + packages, { - {src = "https://git.fifthgrid.com/sgraves/darcula_lush"}, { src = "https://github.com/catgoose/nvim-colorizer.lua", version = "85a5e83cd4daa258cf95c3204e277991d6fbe747" @@ -71,7 +100,6 @@ vim.pack.add( {src = "https://github.com/lewis6991/gitsigns.nvim"}, {src = "https://github.com/mfussenegger/nvim-dap"}, {src = "https://github.com/mhartington/formatter.nvim"}, - {src = "https://github.com/nvim-lua/plenary.nvim"}, {src = "https://github.com/nvim-mini/mini.nvim"}, {src = "https://github.com/nvim-neotest/nvim-nio"}, {src = "https://github.com/nvim-telescope/telescope-ui-select.nvim"}, @@ -79,90 +107,35 @@ vim.pack.add( {src = "https://github.com/nvim-treesitter/nvim-treesitter"}, {src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"}, {src = "https://github.com/rcarriga/nvim-dap-ui"}, - {src = "https://github.com/rktjmp/lush.nvim"}, {src = "https://github.com/rktjmp/shipwright.nvim"}, {src = "https://github.com/sgraves76/cppman.nvim"}, {src = "https://github.com/stevearc/dressing.nvim"}, {src = "https://github.com/ten3roberts/window-picker.nvim"}, {src = "https://github.com/tpope/vim-dispatch"}, {src = "https://github.com/tpope/vim-fugitive"} - }, - {confirm = false} + } ) -if NV_DARCULA_ENABLE_COC then - vim.pack.add( - { - {src = "https://github.com/fannheyward/telescope-coc.nvim"}, - {src = "https://github.com/neoclide/coc.nvim", {version = "release"}}, - {src = "https://github.com/honza/vim-snippets"} - }, - {confirm = false} - ) -else - vim.pack.add( - { - {src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim"}, - {src = "https://github.com/akinsho/flutter-tools.nvim"}, - {src = "https://github.com/kosayoda/nvim-lightbulb"}, - {src = "https://github.com/mason-org/mason-lspconfig.nvim"}, - {src = "https://github.com/mason-org/mason.nvim"}, - {src = "https://github.com/neovim/nvim-lspconfig"} - }, - {confirm = false} - ) +vim.pack.add(packages, {confirm = false}) + +local theme_set = false +local set_colorscheme = function() + if theme_set then + return + end + + vim.cmd("colorscheme " .. NV_DARCULA_COLOR_SCHEME) + theme_set = true end -vim.cmd("packadd! plenary.nvim") +for _, pkg in ipairs(packages) do + local parts = vim.split(pkg.src, "/", {plain = true}) + local name = parts[#parts] + vim.cmd("packadd! " .. name) -vim.cmd("packadd! lush.nvim") -vim.cmd("packadd! darcula_lush") -vim.cmd("colorscheme " .. NV_DARCULA_COLOR_SCHEME) - -if NV_DARCULA_ENABLE_COC then - vim.cmd("packadd! coc.nvim") -else - vim.cmd("packadd! nvim-lspconfig") + if name == NV_DARCULA_COLOR_SCHEME then + set_colorscheme() + end end -vim.cmd("packadd! cppman.nvim") -if NV_DARCULA_ENABLE_COC then - vim.cmd("packadd! dart-vim-plugin") -end -vim.cmd("packadd! dressing.nvim") -if not NV_DARCULA_ENABLE_COC then - vim.cmd("packadd! flutter-tools.nvim") -end -vim.cmd("packadd! formatter.nvim") -vim.cmd("packadd! gitsigns.nvim") -if not NV_DARCULA_ENABLE_COC then - vim.cmd("packadd! mason-lspconfig.nvim") -end -if not NV_DARCULA_ENABLE_COC then - vim.cmd("packadd! mason.nvim") -end -vim.cmd("packadd! mini.nvim") -vim.cmd("packadd! nvim-colorizer.lua") -vim.cmd("packadd! nvim-dap") -vim.cmd("packadd! nvim-dap-go") -vim.cmd("packadd! nvim-dap-ui") -if not NV_DARCULA_ENABLE_COC then - vim.cmd("packadd! nvim-lightbulb") -end -vim.cmd("packadd! nvim-nio") -vim.cmd("packadd! nvim-scrollview") -vim.cmd("packadd! nvim-tree.lua") -vim.cmd("packadd! nvim-treesitter") -vim.cmd("packadd! nvim-treesitter-textobjects") -vim.cmd("packadd! shipwright.nvim") -if NV_DARCULA_ENABLE_COC then - vim.cmd("packadd! telescope-coc.nvim") -end -vim.cmd("packadd! telescope-ui-select.nvim") -vim.cmd("packadd! telescope.nvim") -vim.cmd("packadd! vim-dispatch") -vim.cmd("packadd! vim-fugitive") -if NV_DARCULA_ENABLE_COC then - vim.cmd("packadd! vim-snippets") -end -vim.cmd("packadd! window-picker.nvim") +set_colorscheme() diff --git a/nvim/lua/darcula/setup/100_mason.lua b/nvim/lua/darcula/setup/100_mason.lua index a701bed..64b2e15 100644 --- a/nvim/lua/darcula/setup/100_mason.lua +++ b/nvim/lua/darcula/setup/100_mason.lua @@ -22,6 +22,8 @@ if NV_DARCULA_ENABLE_COC then end local symbols = require("darcula.utils.symbols") +---@diagnostic disable-next-line: deprecated +local unpacker = table.unpack or unpack require("mason").setup { ui = { @@ -58,7 +60,7 @@ for _, name in pairs(NV_DARCULA_MASON_LSP_LIST) do { cmd = { "clangd", - table.unpack(NV_DARCULA_CLANGD_ARGS) + unpacker(NV_DARCULA_CLANGD_ARGS) } } )