Move conform and nvim-lint configuration
This commit is contained in:
parent
4efdebcb0e
commit
129a2dc990
|
@ -2,10 +2,17 @@ local conform = require "conform"
|
|||
|
||||
conform.setup {
|
||||
formatters_by_ft = {
|
||||
rst = { "rstfmt" },
|
||||
bash = { "shellcheck" },
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
just = { "just" },
|
||||
lua = { "stylua" },
|
||||
nix = { { "alejandra", "nixfmt" } },
|
||||
php = { { "php_cs_fixer", "phpcbf" } },
|
||||
terraform = { "terraform_fmt" },
|
||||
yaml = { "yamlfmt" },
|
||||
},
|
||||
}
|
||||
|
||||
conform.formatters.rstfmt = {
|
||||
command = "rstfmt";
|
||||
}
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
conform.format { lsp_fallback = true, async = false, timeout_ms = 500 }
|
||||
end)
|
||||
|
|
19
after/plugin/lint.lua
Normal file
19
after/plugin/lint.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local lint = require "lint"
|
||||
|
||||
lint.linters_by_ft = {
|
||||
dockerfile = { "hadolint" },
|
||||
javascript = { "eslint_d" },
|
||||
json = { "jsonlint" },
|
||||
lua = { "luacheck" },
|
||||
markdown = { "markdownlint" },
|
||||
nix = { "nix" },
|
||||
php = { "php", "phpcs", "phpstan" },
|
||||
}
|
||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
|
@ -159,43 +159,3 @@ vim.diagnostic.config {
|
|||
update_in_insert = false,
|
||||
virtual_text = { spacing = 2 },
|
||||
}
|
||||
|
||||
local conform = require "conform"
|
||||
|
||||
conform.setup {
|
||||
formatters_by_ft = {
|
||||
bash = { "shellcheck" },
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
just = { "just" },
|
||||
lua = { "stylua" },
|
||||
nix = { { "alejandra", "nixfmt" } },
|
||||
php = { { "php_cs_fixer", "phpcbf" } },
|
||||
terraform = { "terraform_fmt" },
|
||||
yaml = { "yamlfmt" },
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
conform.format { lsp_fallback = true, async = false, timeout_ms = 500 }
|
||||
end)
|
||||
|
||||
local lint = require "lint"
|
||||
|
||||
lint.linters_by_ft = {
|
||||
dockerfile = { "hadolint" },
|
||||
javascript = { "eslint_d" },
|
||||
json = { "jsonlint" },
|
||||
lua = { "luacheck" },
|
||||
markdown = { "markdownlint" },
|
||||
nix = { "nix" },
|
||||
php = { "php", "phpcs", "phpstan" },
|
||||
}
|
||||
|
||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
|
|
Reference in a new issue