From 64cf03dcacf7122537f7523a61624086900b1785 Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Sat, 10 Feb 2024 16:15:03 +0100 Subject: [PATCH] [neovim] Add python goodies --- .config/nvim/README.md | 1 + .config/nvim/lua/core/lazy.lua | 15 ++++++++++++++- .config/nvim/lua/plugins/dap.lua | 4 +++- .config/nvim/lua/plugins/lualine.lua | 5 +++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.config/nvim/README.md b/.config/nvim/README.md index 15e45a4..c7baa3e 100644 --- a/.config/nvim/README.md +++ b/.config/nvim/README.md @@ -12,6 +12,7 @@ Neovim conf heavily adapted to suit my needs, formerly based on LunarVim's [basi * stylua * python-cfn-lint * python-black +* python-debugpy * hadolint * revive * tree-sitter-cli diff --git a/.config/nvim/lua/core/lazy.lua b/.config/nvim/lua/core/lazy.lua index 3876e65..35c573a 100644 --- a/.config/nvim/lua/core/lazy.lua +++ b/.config/nvim/lua/core/lazy.lua @@ -226,9 +226,20 @@ require("lazy").setup({ -- DAP { "mfussenegger/nvim-dap", event = "VeryLazy", version = "0.*" }, { "rcarriga/nvim-dap-ui", event = "VeryLazy", version = "v3.*" }, - { "ravenxrz/DAPInstall.nvim", event = "VeryLazy" }, { "theHamsta/nvim-dap-virtual-text", event = "VeryLazy" }, + -- Python + { + "linux-cultist/venv-selector.nvim", + dependencies = { + "mfussenegger/nvim-dap-python", + }, + opts = { + dap_enabled = true, + }, + event = "VeryLazy", + }, + -- Go { "ray-x/go.nvim", @@ -239,6 +250,8 @@ require("lazy").setup({ event = { "CmdlineEnter" }, ft = { "go", "gomod" }, }, + + -- Testing { "nvim-neotest/neotest", dependencies = { diff --git a/.config/nvim/lua/plugins/dap.lua b/.config/nvim/lua/plugins/dap.lua index aefa208..f23996b 100644 --- a/.config/nvim/lua/plugins/dap.lua +++ b/.config/nvim/lua/plugins/dap.lua @@ -1,7 +1,9 @@ local dap = require("dap") local dapui = require("dapui") -require("dap-install").config("python", {}) +local debugpyPythonPath = require("mason-registry").get_package("debugpy"):get_install_path() .. "/venv/bin/python3" +require("dap-python").setup(debugpyPythonPath, {}) + dapui.setup({ layouts = { { diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index b248bf4..863e121 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -41,6 +41,11 @@ local venv = function() return string.format(" %s", string.match(venv, "[^/]+$")) end + venv = require("venv-selector").get_active_venv() + if venv then + return string.format(" %s", string.match(venv, "[^/]+$")) + end + return "" end