From 836286798e959fbaa43bd4502561cf85aea537c9 Mon Sep 17 00:00:00 2001 From: Luc Sinet Date: Sat, 17 Jul 2021 00:30:38 +0200 Subject: [Feature] add linter support (#982) --- lua/core/linter.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lua/core/linter.lua (limited to 'lua/core/linter.lua') diff --git a/lua/core/linter.lua b/lua/core/linter.lua new file mode 100644 index 00000000..9c6649a8 --- /dev/null +++ b/lua/core/linter.lua @@ -0,0 +1,33 @@ +local M = {} + +M.setup = function() + if O.lint_on_save then + require("lv-utils").define_augroups { + autolint = { + { + "BufWritePost", + "", + ":silent lua require('lint').try_lint()", + }, + { + "BufEnter", + "", + ":silent lua require('lint').try_lint()", + }, + }, + } + end +end + +local status_ok, linter = 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 -- cgit v1.2.3