change nulls config
This commit is contained in:
parent
709eb50b14
commit
a1540206c4
@ -284,30 +284,46 @@ return require('packer').startup {
|
||||
end
|
||||
}
|
||||
|
||||
use({'jose-elias-alvarez/null-ls.nvim',
|
||||
config= function()
|
||||
require("null-ls").setup({
|
||||
on_attach = function(client)
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.cmd([[
|
||||
augroup LspFormatting
|
||||
autocmd! * <buffer>
|
||||
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
|
||||
augroup END
|
||||
]])
|
||||
end
|
||||
end,
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.prettier,
|
||||
require("null-ls").builtins.formatting.trim_whitespace,
|
||||
require("null-ls").builtins.formatting.trim_newlines,
|
||||
require("null-ls").builtins.formatting.black,
|
||||
require("null-ls").builtins.diagnostics.eslint,
|
||||
require("null-ls").builtins.completion.spell,
|
||||
},
|
||||
})
|
||||
end})
|
||||
|
||||
-- use({'jose-elias-alvarez/null-ls.nvim',
|
||||
-- config= function()
|
||||
-- local lsp_formatting = function(bufnr)
|
||||
-- vim.lsp.buf.format({
|
||||
-- filter = function(clients)
|
||||
-- -- filter out clients that you don't want to use
|
||||
-- return vim.tbl_filter(function(client)
|
||||
-- return client.name ~= "gopls"
|
||||
-- end, clients)
|
||||
-- end,
|
||||
-- bufnr = bufnr,
|
||||
-- })
|
||||
-- end
|
||||
--
|
||||
-- -- if you want to set up formatting on save, you can use this as a callback
|
||||
-- local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
--
|
||||
-- require("null-ls").setup({
|
||||
-- on_attach = function(client,bufnr)
|
||||
-- if client.supports_method("textDocument/formatting") then
|
||||
-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
-- group = augroup,
|
||||
-- buffer = bufnr,
|
||||
-- callback = function()
|
||||
-- lsp_formatting(bufnr)
|
||||
-- end,
|
||||
-- })
|
||||
-- end
|
||||
-- end,
|
||||
-- sources = {
|
||||
-- require("null-ls").builtins.formatting.prettier,
|
||||
-- require("null-ls").builtins.formatting.trim_whitespace,
|
||||
-- require("null-ls").builtins.formatting.trim_newlines,
|
||||
-- require("null-ls").builtins.formatting.black,
|
||||
-- require("null-ls").builtins.diagnostics.eslint,
|
||||
-- },
|
||||
-- })
|
||||
-- end})
|
||||
--
|
||||
-- File manager
|
||||
use({
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
|
Loading…
Reference in New Issue
Block a user