summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/custom/plugins
diff options
context:
space:
mode:
authorKyren223 <ulmliad223@gmail.com>2024-08-04 01:01:44 +0300
committerKyren223 <ulmliad223@gmail.com>2024-08-04 01:01:44 +0300
commit929b1530529390935b0ea9ad888f6f78128ce222 (patch)
tree0a3e65703dee0d1a12ebd220f9b93ffd77d57ab3 /.config/nvim/lua/custom/plugins
parent74f5f270a38dce35f481ae29822db6d4663f8875 (diff)
refactor(nvim): moved mason to it's own file out of lspconfig
Diffstat (limited to '.config/nvim/lua/custom/plugins')
-rw-r--r--.config/nvim/lua/custom/plugins/lspconfig.lua24
-rw-r--r--.config/nvim/lua/custom/plugins/mason.lua38
-rw-r--r--.config/nvim/lua/custom/plugins/nvim-lspconfig.lua29
3 files changed, 67 insertions, 24 deletions
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,
+}