From 45611aaec2866d7d6a52171f11f535be5640c460 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Thu, 12 Oct 2023 16:01:23 +0800 Subject: [PATCH] feat(python): add key binding for organize imports --- 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 ff4267fb..feb628c1 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()