-- Deactivate fold for python files vim.opt.foldlevel = 99 -- Ruff import sorting and formatting vim.api.nvim_create_autocmd("BufWritePre", { buffer = 0, callback = function() -- Tri des imports via code action Ruff local clients = vim.lsp.get_clients({ bufnr = 0 }) for _, c in ipairs(clients) do if c.name == "ruff" then vim.lsp.buf.code_action({ context = { only = { "source.organizeImports.ruff" } }, apply = true, }) break end end -- Formatage du code vim.lsp.buf.format({ async = false }) end, })