Enable formatting disable config in vim
This commit is contained in:
parent
cc64429d00
commit
80cd03dd36
1 changed files with 53 additions and 49 deletions
|
@ -2,7 +2,8 @@
|
|||
-- - LSP diagnostics config -
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
require("formatter").setup({
|
||||
if not vim.g.disable_formatting then
|
||||
require("formatter").setup({
|
||||
filetype = {
|
||||
python = {
|
||||
require("formatter.filetypes.python").isort,
|
||||
|
@ -50,7 +51,8 @@ require("formatter").setup({
|
|||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
end
|
||||
|
||||
require("lint").linters_by_ft = {
|
||||
python = { "flake8" },
|
||||
|
@ -103,7 +105,9 @@ vim.api.nvim_create_user_command("Format", vim.lsp.buf.format, { desc = "Format
|
|||
-- Auto linting
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
callback = function()
|
||||
if not vim.g.disable_formatting then
|
||||
vim.cmd("FormatWrite")
|
||||
end
|
||||
require("lint").try_lint()
|
||||
require("lint").try_lint({ "codespell" })
|
||||
require("lint").try_lint({ "misspell" })
|
||||
|
|
Loading…
Add table
Reference in a new issue