add formatting on save
This commit is contained in:
parent
be8153969b
commit
52c2852aa9
@ -169,6 +169,16 @@ return require('packer').startup {
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user