[UPDATE] split python config to the plugin level and added os specific ruff file

This commit is contained in:
Daveanand Mannie
2025-03-28 03:35:42 -04:00
parent 007dcb8d4d
commit 152fe4a568
4 changed files with 67 additions and 138 deletions

View File

@@ -0,0 +1,53 @@
-- INFO: for local ruff config
local os_info = require("os_info")
local config_path
-- Determine the config path based on the OS
if os_info.is_linux then
config_path = os.getenv("HOME") .. "/.config/nvim/ruff.toml"
elseif os_info.is_windows then
config_path = os.getenv("LOCALAPPDATA") .. "\\nvim\\ruff.toml"
end
return {
{
"neovim/nvim-lspconfig",
opts = {
inlay_hints = { enabled = false },
servers = {
ruff = {
cmd_env = { RUFF_TRACE = "messages" },
init_options = {
settings = {
logLevel = "error",
configuration = config_path, -- Use the dynamically set config_path
configurationPreference = "filesystemFirst",
},
},
keys = {
{
"<leader>co",
LazyVim.lsp.action["source.organizeImports"],
desc = "Organize Imports",
},
},
},
basedpyright = {
cmd_env = { RUFF_TRACE = "messages" },
init_options = {
settings = {
logLevel = "error",
},
},
},
},
setup = {
basedpyright = function()
LazyVim.lsp.on_attach(function(client, _)
client.server_capabilities.hoverProvider = true
end, "basedpyright")
end,
},
},
},
}

View File

@@ -0,0 +1,13 @@
return {
"linux-cultist/venv-selector.nvim",
lazy = false,
branch = "regexp", -- This is the regexp branch, use this for the new version
keys = {
{ "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv", ft = "python" },
},
opts = {
settings = {
options = { notify_user_on_venv_activation = true },
},
},
}