From 540268d618627079c9b958a955b586e1888b46a8 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Tue, 10 Aug 2021 23:15:04 +0200 Subject: Major refactor of nvim --- .config/nvim/lua/plugins.lua | 170 ++++++++++--------------------------------- 1 file changed, 39 insertions(+), 131 deletions(-) (limited to '.config/nvim/lua/plugins.lua') diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index e019fbd..14960ee 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -1,17 +1,17 @@ return { -- Packer can manage itself as an optional plugin { "wbthomason/packer.nvim" }, - - -- TODO: refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function) { "neovim/nvim-lspconfig" }, + { "tamago324/nlsp-settings.nvim" }, + { "jose-elias-alvarez/null-ls.nvim" }, { "kabouzeid/nvim-lspinstall", event = "VimEnter", config = function() local lspinstall = require "lspinstall" lspinstall.setup() - if O.plugin.lspinstall.on_config_done then - O.plugin.lspinstall.on_config_done(lspinstall) + if options.builtin.lspinstall.on_config_done then + options.builtin.lspinstall.on_config_done(lspinstall) end end, }, @@ -25,8 +25,8 @@ return { "nvim-telescope/telescope.nvim", config = function() require("core.telescope").setup() - if O.plugin.telescope.on_config_done then - O.plugin.telescope.on_config_done(require "telescope") + if options.builtin.telescope.on_config_done then + options.builtin.telescope.on_config_done(require "telescope") end end, }, @@ -37,8 +37,8 @@ return { -- event = "InsertEnter", config = function() require("core.compe").setup() - if O.plugin.compe.on_config_done then - O.plugin.compe.on_config_done(require "compe") + if options.builtin.compe.on_config_done then + options.builtin.compe.on_config_done(require "compe") end end, }, @@ -49,8 +49,8 @@ return { -- event = "InsertEnter", config = function() require "core.autopairs" - if O.plugin.autopairs.on_config_done then - O.plugin.autopairs.on_config_done(require "nvim-autopairs") + if options.builtin.autopairs.on_config_done then + options.builtin.autopairs.on_config_done(require "nvim-autopairs") end end, }, @@ -65,30 +65,8 @@ return { "nvim-treesitter/nvim-treesitter", config = function() require("core.treesitter").setup() - if O.plugin.treesitter.on_config_done then - O.plugin.treesitter.on_config_done(require "nvim-treesitter.configs") - end - end, - }, - - -- Formatter.nvim - { - "mhartington/formatter.nvim", - config = function() - require "core.formatter" - if O.plugin.formatter.on_config_done then - O.plugin.formatter.on_config_done(require "formatter") - end - end, - }, - - -- Linter - { - "mfussenegger/nvim-lint", - config = function() - require("core.linter").setup() - if O.plugin.lint.on_config_done then - O.plugin.lint.on_config_done(require "lint") + if options.builtin.treesitter.on_config_done then + options.builtin.treesitter.on_config_done(require "nvim-treesitter.configs") end end, }, @@ -101,19 +79,18 @@ return { -- commit = "fd7f60e242205ea9efc9649101c81a07d5f458bb", config = function() require("core.nvimtree").setup() - if O.plugin.nvimtree.on_config_done then - O.plugin.nvimtree.on_config_done(require "nvim-tree.config") + if options.builtin.nvimtree.on_config_done then + options.builtin.nvimtree.on_config_done(require "nvim-tree.config") end end, }, { "lewis6991/gitsigns.nvim", - config = function() require("core.gitsigns").setup() - if O.plugin.gitsigns.on_config_done then - O.plugin.gitsigns.on_config_done(require "gitsigns") + if options.builtin.gitsigns.on_config_done then + options.builtin.gitsigns.on_config_done(require "gitsigns") end end, event = "BufRead", @@ -124,8 +101,8 @@ return { "folke/which-key.nvim", config = function() require("core.which-key").setup() - if O.plugin.which_key.on_config_done then - O.plugin.which_key.on_config_done(require "which-key") + if options.builtin.which_key.on_config_done then + options.builtin.which_key.on_config_done(require "which-key") end end, event = "BufWinEnter", @@ -138,11 +115,13 @@ return { config = function() local status_ok, nvim_comment = pcall(require, "nvim_comment") if not status_ok then + local Log = require "core.log" + Log:get_default().error "Failed to load nvim-comment" return end nvim_comment.setup() - if O.plugin.comment.on_config_done then - O.plugin.comment.on_config_done(nvim_comment) + if options.builtin.comment.on_config_done then + options.builtin.comment.on_config_done(nvim_comment) end end, }, @@ -150,8 +129,8 @@ return { { "ahmedkhalf/lsp-rooter.nvim", config = function() - if O.plugin.rooter.on_config_done then - O.plugin.rooter.on_config_done() + if options.builtin.rooter.on_config_done then + options.builtin.rooter.on_config_done() end end, }, @@ -164,20 +143,20 @@ return { "glepnir/galaxyline.nvim", config = function() require "core.galaxyline" - if O.plugin.galaxyline.on_config_done then - O.plugin.galaxyline.on_config_done(require "galaxyline") + if options.builtin.galaxyline.on_config_done then + options.builtin.galaxyline.on_config_done(require "galaxyline") end end, event = "BufWinEnter", - disable = not O.plugin.galaxyline.active, + disable = not options.builtin.galaxyline.active, }, { "romgrk/barbar.nvim", config = function() require "core.bufferline" - if O.plugin.bufferline.on_config_done then - O.plugin.bufferline.on_config_done() + if options.builtin.bufferline.on_config_done then + options.builtin.bufferline.on_config_done() end end, event = "BufWinEnter", @@ -189,11 +168,11 @@ return { -- event = "BufWinEnter", config = function() require("core.dap").setup() - if O.plugin.dap.on_config_done then - O.plugin.dap.on_config_done(require "dap") + if options.builtin.dap.on_config_done then + options.builtin.dap.on_config_done(require "dap") end end, - disable = not O.plugin.dap.active, + disable = not options.builtin.dap.active, }, -- Debugger management @@ -201,7 +180,7 @@ return { "Pocco81/DAPInstall.nvim", -- event = "BufWinEnter", -- event = "BufRead", - disable = not O.plugin.dap.active, + disable = not options.builtin.dap.active, }, -- Builtins, these do not load by default @@ -212,11 +191,11 @@ return { event = "BufWinEnter", config = function() require("core.dashboard").setup() - if O.plugin.dashboard.on_config_done then - O.plugin.dashboard.on_config_done(require "dashboard") + if options.builtin.dashboard.on_config_done then + options.builtin.dashboard.on_config_done(require "dashboard") end end, - disable = not O.plugin.dashboard.active, + disable = not options.builtin.dashboard.active, }, { @@ -224,81 +203,10 @@ return { event = "BufWinEnter", config = function() require("core.terminal").setup() - if O.plugin.terminal.on_config_done then - O.plugin.terminal.on_config_done(require "toggleterm") - end - end, - disable = not O.plugin.terminal.active, - }, - - -- Zen Mode - { - "folke/zen-mode.nvim", - cmd = "ZenMode", - event = "BufRead", - config = function() - require("core.zen").setup() - if O.plugin.zen.on_config_done then - O.plugin.zen.on_config_done(require "zen-mode") + if options.builtin.terminal.on_config_done then + options.builtin.terminal.on_config_done(require "toggleterm") end end, - disable = not O.plugin.zen.active, + disable = not options.builtin.terminal.active, }, - - -- Hop - { - "phaazon/hop.nvim", - event = "BufWinEnter", - config = function() - require("core.hop").config() - if O.plugin.hop.on_config_done then - O.plugin.hop.on_config_done(require "hop") - end - end, - disable = not O.plugin.hop.active, - }, - - { - "norcalli/nvim-colorizer.lua", - event = "BufWinEnter", - config = function() - require("core.colorizer").config() - if O.plugin.colorizer.on_config_done then - O.plugin.colorizer.on_config_done(require "nvim-colorizer") - end - end, - disable = not O.plugin.colorizer.active, - }, - - --------------------------------------------------------------------------------- - - -- LANGUAGE SPECIFIC GOES HERE - { - "lervag/vimtex", - ft = "tex", - }, - - -- Rust tools - -- TODO: use lazy loading maybe? - { - "simrat39/rust-tools.nvim", - disable = not O.lang.rust.rust_tools.active, - }, - - -- Elixir - { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } }, - - -- Javascript / Typescript - { - "jose-elias-alvarez/nvim-lsp-ts-utils", - ft = { - "javascript", - "javascriptreact", - "javascript.jsx", - "typescript", - "typescriptreact", - "typescript.tsx", - }, - }, - } -- cgit v1.2.3-70-g09d2