diff --git a/README.md b/README.md index dfc165d..3153ca5 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Some servers have additional runtime dependencies: - **bash-language-server**: shellcheck (optional, used for linting) -If you don't need some specific language server, and want to get rid of any warning messages, you may either remove them from `lua/lsp/servers/init.lua` or disable them in `lua/lsp/servers/.lua`. +If you don't need some specific language server, and want to get rid of any warning messages, you may either remove them from the top of `lua/lsp/init.lua` or disable them in `lua/lsp/config/.lua`. ### Clipboard see `:checkhealth` and `:h clipboard`. diff --git a/init.lua b/init.lua index fced91f..7ffe30a 100644 --- a/init.lua +++ b/init.lua @@ -40,7 +40,7 @@ else return end - ok, err = pcall(require, "plugins") + ok, err = pcall(require, "plugin") if not ok then utils.err("Error while loading plugins", module_name) utils.err(err:gsub("\t", " "), module_name) diff --git a/lazy-lock.json b/lazy-lock.json index f8231a2..386b542 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,7 +2,7 @@ "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "Jenkinsfile-vim-syntax": { "branch": "master", "commit": "0d05729168ea44d60862f17cffa80024ab30bcc9" }, "LuaSnip": { "branch": "master", "commit": "0b4950a237ce441a6a3a947d501622453f6860ea" }, - "aerial.nvim": { "branch": "master", "commit": "fc04a097d0b0e828dfd508f9b079774bd072431e" }, + "aerial.nvim": { "branch": "master", "commit": "f34defe8f5c2d27f49d53fe0269b87a16f1fb1b9" }, "bufdelete.nvim": { "branch": "master", "commit": "07d1f8ba79dec59d42b975a4df1c732b2e4e37b4" }, "bufferline.nvim": { "branch": "main", "commit": "9961d87bb3ec008213c46ba14b3f384a5f520eb5" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -11,7 +11,7 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, - "gitsigns.nvim": { "branch": "main", "commit": "d927caa075df63bf301d92f874efb72fd22fd3b4" }, + "gitsigns.nvim": { "branch": "main", "commit": "bf6b0bbc527c546ecd6af2bb9fcd06864ae0852c" }, "indentLine": { "branch": "master", "commit": "b96a75985736da969ac38b72a7716a8c57bdde98" }, "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, "lsp_signature.nvim": { "branch": "master", "commit": "58d4e810801da74c29313da86075d6aea537501f" }, @@ -19,19 +19,19 @@ "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "dfdd771b792fbb4bad8e057d72558255695aa1a7" }, "mason-update-all": { "branch": "main", "commit": "007a4085fe5e830b9139313652e1553bf1a9b857" }, - "mason.nvim": { "branch": "main", "commit": "0942198fb9a998b6ccee36fb8dd7495eb8ba659c" }, + "mason.nvim": { "branch": "main", "commit": "ee6a7f179ebf8aa9da9d53b1cf1b57d292ea0182" }, "neorg": { "branch": "main", "commit": "20502e50e9087248f6f8ed8d29fae9c849c1c77f" }, - "nvim-autopairs": { "branch": "master", "commit": "a52fc6eeec116746110b703381777c46d89d9e27" }, + "nvim-autopairs": { "branch": "master", "commit": "35493556b895f54c129918aca43ae9a63af42a1f" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, "nvim-dap": { "branch": "master", "commit": "31e1ece773e10448dcb616d5144290946a6264b7" }, "nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" }, - "nvim-lspconfig": { "branch": "master", "commit": "a27356f1ef9c11e1f459cc96a3fcac5c265e72d6" }, + "nvim-lspconfig": { "branch": "master", "commit": "0517d8522dcec286b1dba47aa3ee1ed8f523aed6" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, - "nvim-tree.lua": { "branch": "master", "commit": "5897b3622f033b1f3ea6adf8eb1c165e9f20554f" }, - "nvim-treesitter": { "branch": "master", "commit": "9d637b7ae8fa17cea8600e91d1145e2095c2a15d" }, + "nvim-tree.lua": { "branch": "master", "commit": "ec33d4befa74205e09baf8bb4f90be5be754e6ab" }, + "nvim-treesitter": { "branch": "master", "commit": "cc56e1f093868892fc7fea68ac3a51f5ffc38728" }, "nvim-web-devicons": { "branch": "master", "commit": "bc11ee2498de2310de5776477dd9dce65d03b464" }, "plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" }, - "telescope.nvim": { "branch": "master", "commit": "6b79d7a6a45adc1508a7afee5bc973173ec22f59" }, + "telescope.nvim": { "branch": "master", "commit": "20a37e43bb43c74c6091f9fea6551af0964ad45a" }, "vim-flog": { "branch": "master", "commit": "58c1d39ec42f92d23a1204b1869e5d1dece8b86c" }, "vim-fugitive": { "branch": "master", "commit": "572c8510123cbde02e8a1dafcd376c98e1e13f43" }, "vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" }, diff --git a/lua/config/aerial.lua b/lua/config/aerial.lua deleted file mode 100644 index a100a56..0000000 --- a/lua/config/aerial.lua +++ /dev/null @@ -1,40 +0,0 @@ ---[[ - Copyright 2023 Oscar Wallberg - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -]] - --- https://github.com/stevearc/aerial.nvim - -require("aerial").setup({ - layout = { - min_width = 40, - placement = "edge", - }, - disable_max_size = 10000000, - highlight_on_hover = true, - ignore = { - unlisted_buffers = true, - }, - on_attach = function (bufnr) - -- Toggle the aerial window with a - vim.api.nvim_buf_set_keymap(bufnr, "n", "at", "AerialToggle!", {}) - -- Jump forwards/backwards with '{' and '}' - vim.api.nvim_buf_set_keymap(bufnr, "n", "{", "AerialPrev", {}) - vim.api.nvim_buf_set_keymap(bufnr, "n", "}", "AerialNext", {}) - -- Jump up the tree with '[[' or ']]' - vim.api.nvim_buf_set_keymap(bufnr, "n", "[[", "AerialPrevUp", {}) - vim.api.nvim_buf_set_keymap(bufnr, "n", "]]", "AerialNextUp", {}) - end, - show_guides = true, -}) diff --git a/lua/config/bufdelete.lua b/lua/config/bufdelete.lua deleted file mode 100644 index 14496ee..0000000 --- a/lua/config/bufdelete.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.keymap.set( - "n", - "q", - ":Bwipeout", - { remap = false, silent = true, } -) diff --git a/lua/lsp/servers/bashls.lua b/lua/lsp/config/bashls.lua similarity index 100% rename from lua/lsp/servers/bashls.lua rename to lua/lsp/config/bashls.lua diff --git a/lua/lsp/servers/clangd.lua b/lua/lsp/config/clangd.lua similarity index 100% rename from lua/lsp/servers/clangd.lua rename to lua/lsp/config/clangd.lua diff --git a/lua/lsp/servers/cmake.lua b/lua/lsp/config/cmake.lua similarity index 100% rename from lua/lsp/servers/cmake.lua rename to lua/lsp/config/cmake.lua diff --git a/lua/lsp/servers/diagnosticls.lua b/lua/lsp/config/diagnosticls.lua similarity index 100% rename from lua/lsp/servers/diagnosticls.lua rename to lua/lsp/config/diagnosticls.lua diff --git a/lua/lsp/servers/groovyls.lua b/lua/lsp/config/groovyls.lua similarity index 100% rename from lua/lsp/servers/groovyls.lua rename to lua/lsp/config/groovyls.lua diff --git a/lua/lsp/servers/jedi_language_server.lua b/lua/lsp/config/jedi_language_server.lua similarity index 100% rename from lua/lsp/servers/jedi_language_server.lua rename to lua/lsp/config/jedi_language_server.lua diff --git a/lua/lsp/servers/lemminx.lua b/lua/lsp/config/lemminx.lua similarity index 100% rename from lua/lsp/servers/lemminx.lua rename to lua/lsp/config/lemminx.lua diff --git a/lua/lsp/servers/lua_ls.lua b/lua/lsp/config/lua_ls.lua similarity index 100% rename from lua/lsp/servers/lua_ls.lua rename to lua/lsp/config/lua_ls.lua diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 0833cc6..be3ad7c 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -14,7 +14,7 @@ limitations under the License. ]] -local module_name = "lsp" +local package_name = "lsp" local utils = require("utils") local P = {} @@ -24,7 +24,20 @@ P._language_servers = nil P.capabilities = {} -P.servers = require("lsp.servers") +P.servers = { + bashls = {}, + clangd = {}, + cmake = {}, + diagnosticls = {}, + groovyls = {}, + jedi_language_server = {}, + lemminx = {}, + lua_ls = {}, +} + +for name, _ in pairs(P.servers) do + P.servers[name] = require("lsp.config." .. name) +end function P._setup_diagnostic() vim.diagnostic.config({ @@ -275,7 +288,7 @@ function P.language_servers(self) name, table.concat(not_installed, ", ") ), - module_name + package_name ) server.enabled = false goto next_server @@ -296,7 +309,7 @@ function P.language_servers(self) name, table.concat(not_installed, ", ") ), - module_name + package_name ) server.enabled = false goto next_server diff --git a/lua/lsp/servers/init.lua b/lua/lsp/servers/init.lua deleted file mode 100644 index d3bc66d..0000000 --- a/lua/lsp/servers/init.lua +++ /dev/null @@ -1,34 +0,0 @@ ---[[ - Copyright 2023 Oscar Wallberg - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -]] - -local servers = { - "bashls", - "clangd", - "cmake", - "diagnosticls", - "groovyls", - "jedi_language_server", - "lemminx", - "lua_ls", -} - -local manifest = {} - -for _, name in ipairs(servers) do - manifest[name] = require("lsp.servers." .. name) -end - -return manifest diff --git a/lua/plugin/config/aerial.lua b/lua/plugin/config/aerial.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/config/autopairs.lua b/lua/plugin/config/autopairs.lua similarity index 100% rename from lua/config/autopairs.lua rename to lua/plugin/config/autopairs.lua diff --git a/lua/plugin/config/bufdelete.lua b/lua/plugin/config/bufdelete.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/config/bufferline.lua b/lua/plugin/config/bufferline.lua similarity index 100% rename from lua/config/bufferline.lua rename to lua/plugin/config/bufferline.lua diff --git a/lua/config/cmp.lua b/lua/plugin/config/cmp.lua similarity index 100% rename from lua/config/cmp.lua rename to lua/plugin/config/cmp.lua diff --git a/lua/config/comment.lua b/lua/plugin/config/comment.lua similarity index 100% rename from lua/config/comment.lua rename to lua/plugin/config/comment.lua diff --git a/lua/config/dap.lua b/lua/plugin/config/dap.lua similarity index 94% rename from lua/config/dap.lua rename to lua/plugin/config/dap.lua index ffc2fb1..8c284e6 100644 --- a/lua/config/dap.lua +++ b/lua/plugin/config/dap.lua @@ -20,8 +20,8 @@ vim.fn.execute("nnoremap :lua require'dap'.continue()") vim.fn.execute("nnoremap :lua require'dap'.step_over()") vim.fn.execute("nnoremap :lua require'dap'.step_into()") vim.fn.execute("nnoremap :lua require'dap'.step_out()") -vim.fn.execute("nnoremap dt :lua require'config.dap'.pytest({'-k', ''})") -vim.fn.execute("nnoremap dl :lua require'config.dap'.launch({''})") +vim.fn.execute("nnoremap dt :lua require'plugin.config.dap'.pytest({'-k', ''})") +vim.fn.execute("nnoremap dl :lua require'plugin.config.dap'.launch({''})") vim.fn.execute("nnoremap db :lua require'dap'.toggle_breakpoint()") -- vim.fn.execute("nnoremap B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") -- vim.fn.execute("nnoremap lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))") diff --git a/lua/config/dap_ui.lua b/lua/plugin/config/dap_ui.lua similarity index 100% rename from lua/config/dap_ui.lua rename to lua/plugin/config/dap_ui.lua diff --git a/lua/config/flog.lua b/lua/plugin/config/flog.lua similarity index 100% rename from lua/config/flog.lua rename to lua/plugin/config/flog.lua diff --git a/lua/config/fugitive.lua b/lua/plugin/config/fugitive.lua similarity index 100% rename from lua/config/fugitive.lua rename to lua/plugin/config/fugitive.lua diff --git a/lua/config/gitsigns.lua b/lua/plugin/config/gitsigns.lua similarity index 100% rename from lua/config/gitsigns.lua rename to lua/plugin/config/gitsigns.lua diff --git a/lua/config/indentLine.lua b/lua/plugin/config/indentLine.lua similarity index 100% rename from lua/config/indentLine.lua rename to lua/plugin/config/indentLine.lua diff --git a/lua/config/lsp_signature.lua b/lua/plugin/config/lsp_signature.lua similarity index 100% rename from lua/config/lsp_signature.lua rename to lua/plugin/config/lsp_signature.lua diff --git a/lua/config/lualine.lua b/lua/plugin/config/lualine.lua similarity index 100% rename from lua/config/lualine.lua rename to lua/plugin/config/lualine.lua diff --git a/lua/config/luasnip.lua b/lua/plugin/config/luasnip.lua similarity index 100% rename from lua/config/luasnip.lua rename to lua/plugin/config/luasnip.lua diff --git a/lua/config/mason.lua b/lua/plugin/config/mason.lua similarity index 100% rename from lua/config/mason.lua rename to lua/plugin/config/mason.lua diff --git a/lua/config/mason_lspconfig.lua b/lua/plugin/config/mason_lspconfig.lua similarity index 100% rename from lua/config/mason_lspconfig.lua rename to lua/plugin/config/mason_lspconfig.lua diff --git a/lua/config/mason_update_all.lua b/lua/plugin/config/mason_update_all.lua similarity index 100% rename from lua/config/mason_update_all.lua rename to lua/plugin/config/mason_update_all.lua diff --git a/lua/config/neorg.lua b/lua/plugin/config/neorg.lua similarity index 100% rename from lua/config/neorg.lua rename to lua/plugin/config/neorg.lua diff --git a/lua/config/notify.lua b/lua/plugin/config/notify.lua similarity index 100% rename from lua/config/notify.lua rename to lua/plugin/config/notify.lua diff --git a/lua/config/telescope.lua b/lua/plugin/config/telescope.lua similarity index 100% rename from lua/config/telescope.lua rename to lua/plugin/config/telescope.lua diff --git a/lua/config/tree.lua b/lua/plugin/config/tree.lua similarity index 100% rename from lua/config/tree.lua rename to lua/plugin/config/tree.lua diff --git a/lua/config/treesitter.lua b/lua/plugin/config/treesitter.lua similarity index 100% rename from lua/config/treesitter.lua rename to lua/plugin/config/treesitter.lua diff --git a/lua/config/vscode.lua b/lua/plugin/config/vscode.lua similarity index 100% rename from lua/config/vscode.lua rename to lua/plugin/config/vscode.lua diff --git a/lua/config/winresizer.lua b/lua/plugin/config/winresizer.lua similarity index 100% rename from lua/config/winresizer.lua rename to lua/plugin/config/winresizer.lua diff --git a/lua/config/winshift.lua b/lua/plugin/config/winshift.lua similarity index 100% rename from lua/config/winshift.lua rename to lua/plugin/config/winshift.lua diff --git a/lua/plugins.lua b/lua/plugin/init.lua similarity index 66% rename from lua/plugins.lua rename to lua/plugin/init.lua index 91f3cc5..38037c5 100644 --- a/lua/plugins.lua +++ b/lua/plugin/init.lua @@ -21,26 +21,26 @@ local plugins = { "Mofiqul/vscode.nvim", priority = 1000, lazy = false, - config = function () require("config.vscode") end, + config = function () require("plugin.config.vscode") end, }, { "rcarriga/nvim-notify", priority = 900, - config = function () require("config.notify") end, + config = function () require("plugin.config.notify") end, }, { "rafamadriz/friendly-snippets", }, { "L3MON4D3/LuaSnip", - config = function () require("config.luasnip") end, + config = function () require("plugin.config.luasnip") end, -- comment out on windows and install jsregexp manually build = "make install_jsregexp", version = "2.*", }, { "windwp/nvim-autopairs", - config = function () require("config.autopairs") end, + config = function () require("plugin.config.autopairs") end, }, { "saadparwaiz1/cmp_luasnip", @@ -59,23 +59,23 @@ local plugins = { }, { "hrsh7th/nvim-cmp", - config = function () require("config.cmp") end, + config = function () require("plugin.config.cmp") end, }, { "hrsh7th/cmp-nvim-lsp", }, { "williamboman/mason.nvim", - config = function () require("config.mason") end, + config = function () require("plugin.config.mason") end, }, { "williamboman/mason-lspconfig.nvim", - config = function () require("config.mason_lspconfig") end, + config = function () require("plugin.config.mason_lspconfig") end, }, { "ray-x/lsp_signature.nvim", event = "VeryLazy", - config = function () require("config.lsp_signature") end, + config = function () require("plugin.config.lsp_signature") end, }, { "neovim/nvim-lspconfig", @@ -85,42 +85,42 @@ local plugins = { }, { "nvim-treesitter/nvim-treesitter", - config = function () require("config.treesitter") end, + config = function () require("plugin.config.treesitter") end, lazy = true, event = "VimEnter", }, { "mfussenegger/nvim-dap", - config = function () require("config.dap") end, + config = function () require("plugin.config.dap") end, lazy = true, ft = require("lsp"):filetypes(), }, { "rcarriga/nvim-dap-ui", - config = function () require("config.dap_ui") end, + config = function () require("plugin.config.dap_ui") end, }, { "kyazdani42/nvim-web-devicons", }, { "tpope/vim-fugitive", - config = function () require("config.fugitive") end, + config = function () require("plugin.config.fugitive") end, lazy = true, event = "VimEnter", }, { "rbong/vim-flog", - config = function () require("config.flog") end, + config = function () require("plugin.config.flog") end, }, { "nvim-lualine/lualine.nvim", - config = function () require("config.lualine") end, + config = function () require("plugin.config.lualine") end, lazy = true, event = "VimEnter", }, { "akinsho/bufferline.nvim", - config = function () require("config.bufferline") end, + config = function () require("plugin.config.bufferline") end, lazy = true, event = "VimEnter", }, @@ -129,37 +129,37 @@ local plugins = { }, { "lewis6991/gitsigns.nvim", - config = function () require("config.gitsigns") end, + config = function () require("plugin.config.gitsigns") end, lazy = true, event = "VimEnter", }, { "nvim-telescope/telescope.nvim", - config = function () require("config.telescope") end, + config = function () require("plugin.config.telescope") end, lazy = true, event = "VimEnter", }, { "numToStr/Comment.nvim", - config = function () require("config.comment") end, + config = function () require("plugin.config.comment") end, lazy = true, event = "VimEnter", }, { "Yggdroot/indentLine", - config = function () require("config.indentLine") end, + config = function () require("plugin.config.indentLine") end, lazy = true, event = "VimEnter", }, { "simeji/winresizer", - config = function () require("config.winresizer") end, + config = function () require("plugin.config.winresizer") end, lazy = true, keys = { "r", }, }, { "sindrets/winshift.nvim", - config = function () require("config.winshift") end, + config = function () require("plugin.config.winshift") end, lazy = true, keys = { "m", }, }, @@ -170,7 +170,7 @@ local plugins = { }, { "kyazdani42/nvim-tree.lua", - config = function () require("config.tree") end, + config = function () require("plugin.config.tree") end, }, { "dstein64/vim-startuptime", @@ -179,20 +179,20 @@ local plugins = { }, { "stevearc/aerial.nvim", - config = function () require("config.aerial") end, + config = function () require("plugin.config.aerial") end, }, { "nvim-neorg/neorg", build = ":Neorg sync-parsers", - config = function () require("config.neorg") end, + config = function () require("plugin.config.neorg") end, }, { "RubixDev/mason-update-all", - config = function () require("config.mason_update_all") end, + config = function () require("plugin.config.mason_update_all") end, }, { "famiu/bufdelete.nvim", - config = function () require("config.bufdelete") end, + config = function () require("plugin.config.bufdelete") end, }, }