add config

This commit is contained in:
nik
2025-10-05 16:58:08 +03:00
parent 61fc1ec1ba
commit 6b1626bb41
19 changed files with 1022 additions and 0 deletions

34
lua/configs/python.lua Normal file
View File

@@ -0,0 +1,34 @@
local M = {}
M.setup = function()
-- Python-specific settings
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
-- Quick run and lint commands
vim.api.nvim_create_user_command("PythonRun", function()
vim.cmd("!python3 %")
end, {})
vim.api.nvim_create_user_command("PythonLint", function()
vim.cmd("!flake8 %")
end, {})
-- Optional: Virtual environment detection
local function activate_venv()
local venv_path = vim.fn.getcwd() .. "/venv/bin/activate"
if vim.fn.filereadable(venv_path) == 1 then
vim.env.VIRTUAL_ENV = venv_path
vim.cmd("source " .. venv_path)
end
end
-- Try to activate virtual environment when opening Python file
vim.api.nvim_create_autocmd("FileType", {
pattern = "python",
callback = activate_venv
})
end
return M