lsp: add option to disable formatting per buffer
This commit is contained in:
parent
f07683b3c0
commit
ea1f5183d5
1 changed files with 3 additions and 0 deletions
3
init.lua
3
init.lua
|
|
@ -393,6 +393,9 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
local lsp_format = false
|
local lsp_format = false
|
||||||
|
if vim.b.disable_format then
|
||||||
|
return
|
||||||
|
end
|
||||||
for _, client in pairs(vim.lsp.buf_get_clients()) do
|
for _, client in pairs(vim.lsp.buf_get_clients()) do
|
||||||
if client.server_capabilities.documentFormattingProvider then
|
if client.server_capabilities.documentFormattingProvider then
|
||||||
lsp_format = true
|
lsp_format = true
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue