diff options
author | Michaël Ball <michael.ball@krotosaudio.com> | 2025-02-26 12:25:19 +0000 |
---|---|---|
committer | Michaël Ball <michael.ball@krotosaudio.com> | 2025-02-26 12:25:19 +0000 |
commit | 22850e4c2cee741b9e46717e53b8baa6c4a972bb (patch) | |
tree | 556dc3d2881c6149102e787e6cef8bfcd25f323f | |
parent | 0ee90ff3c81e72e8a67ed4aa7ca9dbc799c0c35b (diff) |
Autoformat python on save
-rw-r--r-- | neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua index fbae976..19e2eb4 100644 --- a/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua +++ b/neovim/.config/nvim/lua/plugins/nvim_lspconfig.lua @@ -145,6 +145,19 @@ return { vim.diagnostic.enable(false, { bufnr = args.buf }) end, }) + + vim.api.nvim_create_autocmd({ "BufWritePost" }, { + pattern = '*.py', + callback = function() + vim.lsp.buf.code_action { + context = { + only = { 'source.fixAll.ruff' }, + }, + apply = true, + } + vim.lsp.buf.format { async = true } + end + }) end, }, } |