mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
fix ruff config and linting
This commit is contained in:
@@ -25,22 +25,13 @@ return {
|
||||
local orig_try_lint = lint.try_lint
|
||||
|
||||
lint.try_lint = function(...)
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local buftype = vim.api.nvim_get_option_value("buftype", { buf = bufnr })
|
||||
|
||||
-- Skip linting for non-file buffers (like hover docs)
|
||||
if buftype ~= "" then
|
||||
local opts = select(2, ...)
|
||||
local bufnr = (type(opts) == "table" and opts.bufnr) or vim.api.nvim_get_current_buf()
|
||||
if vim.api.nvim_get_option_value("buftype", { buf = bufnr }) ~= "" then
|
||||
return
|
||||
end
|
||||
|
||||
return orig_try_lint(...)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user