From 5233c6a3d2f42627feea25bfbbdcd17cf4843b0e Mon Sep 17 00:00:00 2001 From: Nikita Avgustanov Date: Thu, 19 Feb 2026 09:34:12 +0400 Subject: [PATCH] Added python support (lsp, linter, formatter) --- init.lua | 20 ++++++++++++++++++-- lua/kickstart/plugins/lint.lua | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index ef0d7be8..a5eacbe9 100644 --- a/init.lua +++ b/init.lua @@ -88,7 +88,6 @@ P.S. You can delete this when you're done too. It's your config now! :) -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' - -- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = false @@ -691,7 +690,14 @@ require('lazy').setup({ bashls = {}, jsonls = {}, yamlls = {}, - -- pyright = {}, + ty = { + configuration = { + rules = { + ['unresolved-reference'] = 'warn', + diagnosticMode = 'workspace', + }, + }, + }, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -734,6 +740,7 @@ require('lazy').setup({ local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code + 'ruff', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -745,6 +752,7 @@ require('lazy').setup({ 'solargraph', 'bashls', 'lua_ls', + 'ty', }, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) automatic_installation = false, handlers = { @@ -794,6 +802,14 @@ require('lazy').setup({ formatters_by_ft = { lua = { 'stylua' }, go = { 'gofmt' }, + python = { + -- To fix auto-fixable lint errors. + 'ruff_fix', + -- To run the Ruff formatter. + 'ruff_format', + -- To organize the imports. + 'ruff_organize_imports', + }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index dec42f09..ecdf36f4 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -7,6 +7,7 @@ return { local lint = require 'lint' lint.linters_by_ft = { markdown = { 'markdownlint' }, + python = { 'ruff' }, } -- To allow other plugins to add linters to require('lint').linters_by_ft,