home: vim: add formatting on save with 'null-ls'
This commit is contained in:
parent
60b87c90fc
commit
3aa859861e
|
@ -1,4 +1,16 @@
|
||||||
lua << EOF
|
lua << EOF
|
||||||
null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
null_ls.setup()
|
null_ls.setup({
|
||||||
|
on_attach = function(client)
|
||||||
|
-- Format on save
|
||||||
|
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,
|
||||||
|
})
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in a new issue