Add debugging configuration for Python IDE-style debug view
This commit is contained in:
parent
97be591856
commit
d02c29901c
1 changed files with 85 additions and 0 deletions
85
.config/nvim/lua/plugins/debugging.lua
Normal file
85
.config/nvim/lua/plugins/debugging.lua
Normal file
|
@ -0,0 +1,85 @@
|
|||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
|
||||
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" })
|
||||
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Start/Continue" })
|
||||
vim.keymap.set("n", "<Leader>do", dap.step_over, { desc = "Step Over" })
|
||||
vim.keymap.set("n", "<Leader>di", dap.step_into, { desc = "Step Into" })
|
||||
vim.keymap.set("n", "<Leader>dt", dap.terminate, { desc = "Terminate Session" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"mfussenegger/nvim-dap-python",
|
||||
"nvim-neotest/nvim-nio",
|
||||
},
|
||||
config = function()
|
||||
require("dapui").setup({
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{ id = "scopes", size = 0.5 },
|
||||
{ id = "breakpoints", size = 0.25 },
|
||||
--{ id = "stacks", size = 0.25 },
|
||||
{ id = "watches", size = 0.25 },
|
||||
},
|
||||
size = 0.3,
|
||||
position = "left",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
{ id = "console", size = 0.6 },
|
||||
{ id = "repl", size = 0.4 },
|
||||
},
|
||||
size = 10,
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
})
|
||||
require("dap-python").setup("uv")
|
||||
local dap = require("dap")
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
require("dapui").open()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
require("dapui").close()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
require("dapui").close()
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
branch = "regexp",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"mfussenegger/nvim-dap",
|
||||
"mfussenegger/nvim-dap-python",
|
||||
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
},
|
||||
keys = {
|
||||
{ "<Leader>ea", "<cmd>VenvSelect<cr>", desc = "Activate Virtual Environment" },
|
||||
{ "<Leader>es", "<cmd>lua print(require('venv-selector').venv())<cr>", desc = "Show Active Virtual Environment" },
|
||||
},
|
||||
opts = {
|
||||
search = {
|
||||
vscode_venvs = {
|
||||
command = "fdfind -p '.*/bin/python$' ~/VSCode/.venvs",
|
||||
},
|
||||
code_venvs = {
|
||||
command = "fdfind -p '.*/bin/python$' ~/Code/.venvs",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue