diff options
| author | Aleksa Vuckovic <aleksa@vuckovic.cc> | 2023-02-24 03:53:10 +0100 |
|---|---|---|
| committer | Aleksa Vuckovic <aleksa@vuckovic.cc> | 2023-02-24 03:53:10 +0100 |
| commit | 0703660d49f22376d52a969e8c3cca64480b0f1b (patch) | |
| tree | ef3986b3b49b07660b0dca8f1a5c7b7bea15f8b2 | |
| parent | 2a5f8920d10c4a85586ae6d697f233ce52144a10 (diff) | |
mason-lspconfig & mason-null-ls
| -rw-r--r-- | lua/user/keymaps.lua | 2 | ||||
| -rw-r--r-- | lua/user/lsp/init.lua | 7 | ||||
| -rw-r--r-- | lua/user/lsp/mason.lua | 36 | ||||
| -rw-r--r-- | lua/user/plugins.lua | 8 |
4 files changed, 45 insertions, 8 deletions
diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index bdf1b6a..17f015b 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -30,7 +30,7 @@ keymap("n", "<Tab>", ":bnext<CR>", opts) keymap("n", "<S-Tab>", ":bprevious<CR>", opts) -- NvimTree -keymap("n", "e", ":NvimTreeToggle<CR>", opts) +keymap("n", "t", ":NvimTreeToggle<CR>", opts) -- Resize with arrows keymap("n", "<C-Up>", ":resize -2<CR>", opts) diff --git a/lua/user/lsp/init.lua b/lua/user/lsp/init.lua index 92ae9bf..202cccb 100644 --- a/lua/user/lsp/init.lua +++ b/lua/user/lsp/init.lua @@ -1,7 +1,8 @@ -local status_ok, _ = pcall(require, "lspconfig") -if not status_ok then +require "user.lsp.mason" + +local status, lspconfig = pcall(require, "lspconfig") +if not status then return end -require "user.lsp.mason" require "user.lsp.ccls" diff --git a/lua/user/lsp/mason.lua b/lua/user/lsp/mason.lua index af77151..1b5717d 100644 --- a/lua/user/lsp/mason.lua +++ b/lua/user/lsp/mason.lua @@ -1,4 +1,10 @@ -require("mason").setup({ +local status, mason = pcall(require, "mason") +if not status then + return +end + +-- mason +mason.setup({ ui = { icons = { package_installed = "✓", @@ -7,3 +13,31 @@ require("mason").setup({ } } }) + +-- mason-lspconfig +require("mason-lspconfig").setup { + ensure_installed = { "pylsp", "bashls", "lua_ls", "cmake" }, +} +require("mason-lspconfig").setup_handlers { + function (server_name) + require("lspconfig")[server_name].setup {} + end +} + +-- mason-null-ls +require('mason-null-ls').setup({ + automatic_setup = true, + ensure_installed = { "cpplint" } +}) +require('mason-null-ls').setup_handlers { + function(source_name, methods) + require("mason-null-ls.automatic_setup")(source_name, methods) + end, +} + +-- null_ls +local status, null_ls = pcall(require, "null-ls") +if not status then + return +end +null_ls.setup() diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 227de7f..a3fd1f2 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -39,12 +39,14 @@ return packer.startup(function(use) use "hrsh7th/cmp-cmdline" use "hrsh7th/cmp-nvim-lua" --- snippets - use "L3MON4D3/LuaSnip" --- LSP +-- LSP, linters & formatters use "neovim/nvim-lspconfig" use "williamboman/mason.nvim" + use "williamboman/mason-lspconfig.nvim" + use "nvim-lua/plenary.nvim" + use "jose-elias-alvarez/null-ls.nvim" + use "jay-babu/mason-null-ls.nvim" -- Colorsheme use "morhetz/gruvbox" |
