Added null-ls plugin.This enables certain tools to act as LSPs
(formatters, linters, etc)
This commit is contained in:
parent
0baee67ded
commit
13b0b340f9
3 changed files with 69 additions and 46 deletions
|
@ -1,8 +1,7 @@
|
||||||
|
|
||||||
local mason_lspconfig = require "mason-lspconfig"
|
local mason_lspconfig = require "mason-lspconfig"
|
||||||
|
|
||||||
mason_lspconfig.setup({
|
mason_lspconfig.setup({
|
||||||
ensure_installed = { "sumneko_lua", "rust_analyzer" , "texlab", "hls"},
|
ensure_installed = { "sumneko_lua", "rust_analyzer", "texlab", "hls", "yamlls" },
|
||||||
automatic_installation = true
|
automatic_installation = true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -42,6 +41,9 @@ local on_attach = function(client, bufnr)
|
||||||
-- pattern = '<buffer>',
|
-- pattern = '<buffer>',
|
||||||
-- callback = function() vim.lsp.buf.format({ async = true }) end
|
-- callback = function() vim.lsp.buf.format({ async = true }) end
|
||||||
-- })
|
-- })
|
||||||
|
if client.name == "yamlls" then
|
||||||
|
client.server_capabilities.document_formatting = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local lspconfig = require "lspconfig"
|
local lspconfig = require "lspconfig"
|
||||||
|
|
10
.config/nvim/lua/plugins/null-ls.lua
Normal file
10
.config/nvim/lua/plugins/null-ls.lua
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
|
null_ls.setup({
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.formatting.rustfmt,
|
||||||
|
null_ls.builtins.formatting.prettierd.with({
|
||||||
|
filetypes = { "html", "json", "yaml", "markdown" },
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
})
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
local packer = require("packer")
|
local packer = require("packer")
|
||||||
|
|
||||||
local plugins = packer.startup({ function(use)
|
local plugins = packer.startup({ function(use)
|
||||||
|
@ -41,6 +40,12 @@ local plugins = packer.startup({function(use)
|
||||||
require 'plugins.lualine'
|
require 'plugins.lualine'
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use { 'rcarriga/nvim-notify',
|
||||||
|
config = function()
|
||||||
|
vim.notify = require("notify")
|
||||||
|
end
|
||||||
|
}
|
||||||
-------------------------------------------------------LSP----------------------------------------------
|
-------------------------------------------------------LSP----------------------------------------------
|
||||||
|
|
||||||
use { "williamboman/mason.nvim",
|
use { "williamboman/mason.nvim",
|
||||||
|
@ -57,6 +62,12 @@ local plugins = packer.startup({function(use)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use { "jose-elias-alvarez/null-ls.nvim",
|
||||||
|
config = function()
|
||||||
|
require "plugins.null-ls"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
use { "L3MON4D3/LuaSnip",
|
use { "L3MON4D3/LuaSnip",
|
||||||
requires = {
|
requires = {
|
||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets",
|
||||||
|
|
Loading…
Add table
Reference in a new issue