diff --git a/init.lua b/init.lua index 87be296..51d9622 100644 --- a/init.lua +++ b/init.lua @@ -68,12 +68,8 @@ vim.keymap.set("n", "f", ":lua vim.lsp.buf.format()") -- diagnostics vim.keymap.set("n", "ds", ":lua vim.diagnostic.open_float()") -vim.keymap.set("n", "dn", function() - vim.diagnostic.jump({ count = 1 }) -end) -vim.keymap.set("n", "dp", function() - vim.diagnostic.jump({ count = -1 }) -end) +vim.keymap.set("n", "dn", function() vim.diagnostic.jump({ count = 1 }) end) +vim.keymap.set("n", "dp", function() vim.diagnostic.jump({ count = -1 }) end) -- VIM PACKS vim.pack.add({ @@ -117,6 +113,11 @@ vim.pack.add({ { src = "https://github.com/nvim-lua/plenary.nvim" }, { src = "https://github.com/nvim-telescope/telescope.nvim" }, + -- venv-selector + { src = "https://github.com/mfussenegger/nvim-dap" }, + { src = "https://github.com/mfussenegger/nvim-dap-python" }, + { src = "https://github.com/linux-cultist/venv-selector.nvim" }, + -- dashboard { src = "https://github.com/nvimdev/dashboard-nvim" }, }) @@ -128,6 +129,19 @@ vim.keymap.set("n", "fg", builtin.live_grep, { desc = "Telescope live gr vim.keymap.set("n", "fb", builtin.buffers, { desc = "Telescope buffers" }) vim.keymap.set("n", "fh", builtin.help_tags, { desc = "Telescope help tags" }) +require("dap-python").setup("python3") +require("venv-selector").setup({ + -- Optional: Customize search paths for virtual environments + search = { + -- Example: Add a custom search path + -- { path = "~/my_projects/venvs", depth = 1 }, + }, + -- Optional: Customize plugin options + options = { + -- Example: Set a default picker (e.g., "telescope") + -- picker = "telescope", + }, +}) require("nvim-treesitter.configs").setup({ ensure_installed = {}, modules = {}, @@ -220,6 +234,7 @@ require("mason").setup() require("mason-lspconfig").setup() require("mason-tool-installer").setup({ ensure_installed = { + "basedpyright", "biome", "djlint", "emmet-language-server", @@ -299,3 +314,13 @@ require("dashboard").setup({ }, }) +local enable_providers = { + "python3_provider", +} + +for _, plugin in pairs(enable_providers) do + vim.g["loaded_" .. plugin] = nil + vim.cmd("runtime " .. plugin) +end + +vim.g.loaded_python3_provider = nil diff --git a/lsp/pylsp.lua b/lsp/pylsp.lua index a3593bf..fc6e8b0 100644 --- a/lsp/pylsp.lua +++ b/lsp/pylsp.lua @@ -10,3 +10,27 @@ vim.lsp.config("pylsp", { }, }, }) + +vim.lsp.config('basedpyright', { + cmd = { 'basedpyright-langserver', '--stdio' }, + filetypes = { 'python' }, + root_markers = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + 'pyrightconfig.json', + '.git', + }, + settings = { + basedpyright = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = 'openFilesOnly', + typeCheckingMode = 'basic', + }, + }, + }, +})