diff options
author | sinanmohd <sinan@sinanmohd.com> | 2025-08-31 15:39:39 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2025-08-31 22:28:28 +0530 |
commit | 31458b74b81df4ef5101c01b26fc28fc32ee821b (patch) | |
tree | 15846c395e3ac5aa085a30d11833b6f531abb345 /home/common/modules/neovim/config/lua/pacman/plugins/lint.lua | |
parent | 07854ac073b6c4a3e749078fa113367105a7af08 (diff) |
feat(home/common): init neovim
Diffstat (limited to 'home/common/modules/neovim/config/lua/pacman/plugins/lint.lua')
-rw-r--r-- | home/common/modules/neovim/config/lua/pacman/plugins/lint.lua | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/home/common/modules/neovim/config/lua/pacman/plugins/lint.lua b/home/common/modules/neovim/config/lua/pacman/plugins/lint.lua new file mode 100644 index 0000000..dec42f0 --- /dev/null +++ b/home/common/modules/neovim/config/lua/pacman/plugins/lint.lua @@ -0,0 +1,60 @@ +return { + + { -- Linting + 'mfussenegger/nvim-lint', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + local lint = require 'lint' + lint.linters_by_ft = { + markdown = { 'markdownlint' }, + } + + -- To allow other plugins to add linters to require('lint').linters_by_ft, + -- instead set linters_by_ft like this: + -- lint.linters_by_ft = lint.linters_by_ft or {} + -- lint.linters_by_ft['markdown'] = { 'markdownlint' } + -- + -- However, note that this will enable a set of default linters, + -- which will cause errors unless these tools are available: + -- { + -- clojure = { "clj-kondo" }, + -- dockerfile = { "hadolint" }, + -- inko = { "inko" }, + -- janet = { "janet" }, + -- json = { "jsonlint" }, + -- markdown = { "vale" }, + -- rst = { "vale" }, + -- ruby = { "ruby" }, + -- terraform = { "tflint" }, + -- text = { "vale" } + -- } + -- + -- You can disable the default linters by setting their filetypes to nil: + -- lint.linters_by_ft['clojure'] = nil + -- lint.linters_by_ft['dockerfile'] = nil + -- lint.linters_by_ft['inko'] = nil + -- lint.linters_by_ft['janet'] = nil + -- lint.linters_by_ft['json'] = nil + -- lint.linters_by_ft['markdown'] = nil + -- lint.linters_by_ft['rst'] = nil + -- lint.linters_by_ft['ruby'] = nil + -- lint.linters_by_ft['terraform'] = nil + -- lint.linters_by_ft['text'] = nil + + -- Create autocommand which carries out the actual linting + -- on the specified events. + local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = lint_augroup, + callback = function() + -- Only run the linter in buffers that you can modify in order to + -- avoid superfluous noise, notably within the handy LSP pop-ups that + -- describe the hovered symbol using Markdown. + if vim.bo.modifiable then + lint.try_lint() + end + end, + }) + end, + }, +} |