From 2cf9de9cf8fbd0b7046b7ea881275929ea75af2e Mon Sep 17 00:00:00 2001 From: Laughing-q <1185102784@qq.com> Date: Tue, 29 Apr 2025 16:38:33 +0800 Subject: [PATCH 1/2] Update autocmds.lua --- plugin/autocmds.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/autocmds.lua b/plugin/autocmds.lua index 019be05..6145772 100644 --- a/plugin/autocmds.lua +++ b/plugin/autocmds.lua @@ -10,7 +10,9 @@ vim.cmd([[ au TermOpen term://* setlocal nonumber norelativenumber ]]) -- Open a file from its last left off position -vim.cmd([[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]) +vim.cmd( + [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]] +) -- File extension specific tabbing -- vim.cmd [[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]] @@ -47,3 +49,9 @@ vim.cmd([[ autocmd Filetype markdown inoremap ,l -------- autocmd Filetype markdown inoremap ,w
<++>
3ki ]]) + +vim.api.nvim_create_autocmd({ "BufWritePost" }, { + callback = function() + require("lint").try_lint() + end, +}) From 7cae60528a465941b0c66d83f1695e0ac3793a00 Mon Sep 17 00:00:00 2001 From: Laughing-q <1185102784@qq.com> Date: Tue, 29 Apr 2025 16:38:38 +0800 Subject: [PATCH 2/2] add linter --- lua/lq/plugins/linter.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lua/lq/plugins/linter.lua diff --git a/lua/lq/plugins/linter.lua b/lua/lq/plugins/linter.lua new file mode 100644 index 0000000..c5d3fc3 --- /dev/null +++ b/lua/lq/plugins/linter.lua @@ -0,0 +1,20 @@ +return { + { + "mfussenegger/nvim-lint", + config = function() + require("lint").linters_by_ft = { + python = { "pylint" }, + } + -- require("lint").linters.pylint = { + -- cmd = "pylint", + -- stdin = true, -- or false if it doesn't support content input via stdin. In that case the filename is automatically added to the arguments. + -- append_fname = true, -- Automatically append the file name to `args` if `stdin = false` (default: true) + -- args = {}, -- list of arguments. Can contain functions with zero arguments that will be evaluated once the linter is used. + -- stream = nil, -- ('stdout' | 'stderr' | 'both') configure the stream to which the linter outputs the linting result. + -- ignore_exitcode = false, -- set this to true if the linter exits with a code != 0 and that's considered normal. + -- env = nil, -- custom environment table to use with the external process. Note that this replaces the *entire* environment, it is not additive. + -- -- parser = your_parse_function, + -- } + end, + }, +}