nvim: Create global option to disable linting
Setting `vim.g.disable_autoformat` to true will disable automatic linting globally, though I have not set up commands or mappings for manual linting. It is also missing buffer-local linting which could be copied from buffer-local formatting.
This commit is contained in:
parent
c977bfea06
commit
8e3ef257d3
2 changed files with 4 additions and 1 deletions
|
@ -85,6 +85,7 @@ local globals = {
|
||||||
tex_flavor = "latex",
|
tex_flavor = "latex",
|
||||||
|
|
||||||
disable_autoformat = true, -- only format files manually
|
disable_autoformat = true, -- only format files manually
|
||||||
|
disable_autolint = false, -- but lint automatically
|
||||||
}
|
}
|
||||||
|
|
||||||
for o, v in pairs(globals) do
|
for o, v in pairs(globals) do
|
||||||
|
|
|
@ -93,7 +93,9 @@ return {
|
||||||
require("lint").linters_by_ft = linters
|
require("lint").linters_by_ft = linters
|
||||||
vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, {
|
vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
|
if not vim.g.disable_autoformat then
|
||||||
require("lint").try_lint()
|
require("lint").try_lint()
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in a new issue