summaryrefslogtreecommitdiff
path: root/.config/nvim
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
parent74f5f270a38dce35f481ae29822db6d4663f8875 (diff)
refactor(nvim): moved mason to it's own file out of lspconfig
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/lua/custom/config/lsp.lua22
-rw-r--r--.config/nvim/lua/custom/config/mason.lua41
-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
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,
+}