summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/core/linter.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/core/linter.lua')
-rw-r--r--.config/nvim/lua/core/linter.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/.config/nvim/lua/core/linter.lua b/.config/nvim/lua/core/linter.lua
new file mode 100644
index 0000000..94dff93
--- /dev/null
+++ b/.config/nvim/lua/core/linter.lua
@@ -0,0 +1,33 @@
+local M = {}
+
+M.setup = function()
+ if O.lint_on_save then
+ require("utils").define_augroups {
+ autolint = {
+ {
+ "BufWritePost",
+ "<buffer>",
+ ":silent lua require('lint').try_lint()",
+ },
+ {
+ "BufEnter",
+ "<buffer>",
+ ":silent lua require('lint').try_lint()",
+ },
+ },
+ }
+ end
+end
+
+local status_ok, _ = pcall(require, "lint")
+if not status_ok then
+ return
+end
+
+if not O.lint_on_save then
+ vim.cmd [[if exists('#autolint#BufWritePost')
+ :autocmd! autolint
+ endif]]
+end
+
+return M