From 8f42733ce526b6c866b26824d78a1822730c2852 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Sat, 14 Oct 2023 23:49:23 +0800 Subject: [PATCH] feat(python): add key binding for organize imports (#1670) --- lua/lazyvim/plugins/extras/lang/python.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 835c9da8..a4783973 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -12,7 +12,23 @@ return { opts = { servers = { pyright = {}, - ruff_lsp = {}, + ruff_lsp = { + keys = { + { + "co", + function() + vim.lsp.buf.code_action({ + apply = true, + context = { + only = { "source.organizeImports" }, + diagnostics = {}, + }, + }) + end, + desc = "Organize Imports", + }, + }, + }, }, setup = { ruff_lsp = function()