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:
Marty Oehme 2023-12-26 10:10:19 +01:00
parent c977bfea06
commit 8e3ef257d3
Signed by: Marty
GPG Key ID: EDBF2ED917B2EF6A
2 changed files with 4 additions and 1 deletions

View File

@ -85,6 +85,7 @@ local globals = {
tex_flavor = "latex",
disable_autoformat = true, -- only format files manually
disable_autolint = false, -- but lint automatically
}
for o, v in pairs(globals) do

View File

@ -93,7 +93,9 @@ return {
require("lint").linters_by_ft = linters
vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, {
callback = function()
require("lint").try_lint()
if not vim.g.disable_autoformat then
require("lint").try_lint()
end
end,
})
end,