diff options
Diffstat (limited to '.config/nvim/lua')
| -rw-r--r-- | .config/nvim/lua/custom/config/lsp.lua | 22 | ||||
| -rw-r--r-- | .config/nvim/lua/custom/config/mason.lua | 41 | ||||
| -rw-r--r-- | .config/nvim/lua/custom/plugins/lspconfig.lua | 24 | ||||
| -rw-r--r-- | .config/nvim/lua/custom/plugins/mason.lua | 38 | ||||
| -rw-r--r-- | .config/nvim/lua/custom/plugins/nvim-lspconfig.lua | 29 |
5 files changed, 68 insertions, 86 deletions
diff --git a/.config/nvim/lua/custom/config/lsp.lua b/.config/nvim/lua/custom/config/lsp.lua index fcb2ff1..0c02e46 100644 --- a/.config/nvim/lua/custom/config/lsp.lua +++ b/.config/nvim/lua/custom/config/lsp.lua @@ -40,27 +40,7 @@ vim.api.nvim_create_autocmd('LspAttach', { end end - -- Register LSP keymaps local to buffer + -- Register buffer local LSP keymaps require('custom.config.lsp-keymaps').setup(bufnr) end, }) - --- TODO: Decide if you want to use conform or not --- --- -- Autoformatting Setup --- require('conform').setup({ --- formatters_by_ft = { --- lua = { 'stylua' }, --- }, --- }) --- --- vim.api.nvim_create_autocmd('BufWritePre', { --- callback = function(args) --- require('conform').format({ --- bufnr = args.buf, --- lsp_fallback = true, --- quiet = true, --- }) --- end, --- }) - diff --git a/.config/nvim/lua/custom/config/mason.lua b/.config/nvim/lua/custom/config/mason.lua deleted file mode 100644 index 9d42879..0000000 --- a/.config/nvim/lua/custom/config/mason.lua +++ /dev/null @@ -1,41 +0,0 @@ --- NOTE: Not language servers but still make sure mason installs them -local ensure_installed = { - stylua = true, -- lua formatting - jdtls = true, -- java eclipse lsp -} -local servers = require('custom.config.language-servers') - -require('mason').setup({ - ui = { - icons = { - package_installed = '✓', - package_pending = '➜', - package_uninstalled = '✗', - }, - }, -}) - -local servers_to_install = vim.tbl_filter(function(key) - local server = servers[key] - if type(server) == 'table' then - return true - else - return server - end -end, vim.tbl_keys(servers)) - -vim.list_extend(ensure_installed, servers_to_install) -require('mason-lspconfig').setup({ ensure_installed = servers_to_install }) - -require('mason-tool-installer').setup({ - ensure_installed = { - 'stylua', -- lua formatter - 'java-debug-adapter', - 'java-test', - }, -}) - --- NOTE: apparently needed due to some issue or smthing? -vim.api.nvim_command('MasonToolsInstall') - - diff --git a/.config/nvim/lua/custom/plugins/lspconfig.lua b/.config/nvim/lua/custom/plugins/lspconfig.lua deleted file mode 100644 index 20536e9..0000000 --- a/.config/nvim/lua/custom/plugins/lspconfig.lua +++ /dev/null @@ -1,24 +0,0 @@ -return { - -- NOTE: Make sure the order is as follows: - -- Mason loads -> Mason lspconfig loads -> Lspconfig loads - 'neovim/nvim-lspconfig', - event = { 'BufReadPre', 'BufNewFile' }, - dependencies = { - 'hrsh7th/cmp-nvim-lsp', - { 'antosha417/nvim-lsp-file-operations', conifg = true }, - { - 'williamboman/mason-lspconfig.nvim', - dependencies = { - { 'williamboman/mason.nvim', cmd = 'Mason' }, - 'WhoIsSethDaniel/mason-tool-installer.nvim', - }, - build = ':MasonUpdate', - config = function() - require('custom.config.mason') - end, - }, - }, - config = function() - require('custom.config.lsp') - end, -} diff --git a/.config/nvim/lua/custom/plugins/mason.lua b/.config/nvim/lua/custom/plugins/mason.lua new file mode 100644 index 0000000..a87318a --- /dev/null +++ b/.config/nvim/lua/custom/plugins/mason.lua @@ -0,0 +1,38 @@ +return { + { + 'williamboman/mason.nvim', + lazy = false, + opts = { + ui = { + icons = { + package_installed = '✓', + package_pending = '➜', + package_uninstalled = '✗', + }, + }, + }, + }, + { + 'WhoIsSethDaniel/mason-tool-installer.nvim', + lazy = false, + opts = { + ensure_installed = { + 'stylua', -- lua formatting + 'clang-format', -- C/C++ formatter + 'codelldb', -- C/C++ debugger + 'cpplint', -- C/C++ linter + 'black', -- python formatter + 'isort', -- python formatter for imports + 'flake8', -- python linter + 'gofumpt', -- go formatter + 'golangci-lint', -- go linter + 'prettierd', -- multi-lang formatter + 'prettier', -- prettierd but slower, used as a fallback + 'jq', -- json formatter + 'jsonlint', -- json linter + 'shellcheck', -- bash linter + 'beautysh', -- shell formatter + }, + }, + }, +} diff --git a/.config/nvim/lua/custom/plugins/nvim-lspconfig.lua b/.config/nvim/lua/custom/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..b864c7a --- /dev/null +++ b/.config/nvim/lua/custom/plugins/nvim-lspconfig.lua @@ -0,0 +1,29 @@ +return { + -- NOTE: Make sure the order is as follows: + -- Mason loads -> Mason lspconfig loads -> Lspconfig loads + 'neovim/nvim-lspconfig', + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + { 'antosha417/nvim-lsp-file-operations', conifg = true }, + { + 'williamboman/mason-lspconfig.nvim', + build = ':MasonUpdate', + config = function() + local language_servers = require('custom.config.language-servers') + local ensure_installed = vim.tbl_filter(function(key) + local server = language_servers[key] + if type(server) == 'table' then + return true + else + return server + end + end, vim.tbl_keys(language_servers)) + require('mason-lspconfig').setup({ ensure_installed = ensure_installed, auto_install = true }) + end, + }, + }, + config = function() + require('custom.config.lsp') + end, +} |
