feat(dap.lua): add configuration for dap and dap-ui plugins to enable debugging features in Neovim

feat(lsp-config.lua): configure python lsp using pylsp to provide language server capabilities for Python files
refactor(magma.lua): remove magma plugin configuration as it is no longer used
feat(mason.lua): add configuration for mason and mason-nvim-dap plugins to enable package management and debugging features in Neovim
refactor(init.lua): set maplocalleader to "\\" for easier keybindings
refactor(remap.lua): remove setting mapleader to " " as it is no longer needed, add keybinding for toggling file explorer using NvimTreeToggle command
This commit is contained in:
David Ibia
2024-01-03 01:13:50 +01:00
parent 589ab57da2
commit 68421c4615
10 changed files with 66 additions and 9 deletions

View File

@@ -17,10 +17,14 @@
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" }, "lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
"magma-nvim": { "branch": "main", "commit": "ff3deba8a879806a51c005e50782130246143d06" }, "magma-nvim": { "branch": "main", "commit": "ff3deba8a879806a51c005e50782130246143d06" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "9e82ded0515186edd4f69e4ce6b1a5f1b55b47e9" },
"mason.nvim": { "branch": "main", "commit": "a09da6ac634926a299dd439da08bdb547a8ca011" }, "mason.nvim": { "branch": "main", "commit": "a09da6ac634926a299dd439da08bdb547a8ca011" },
"mini.nvim": { "branch": "main", "commit": "b5645ac6eefce8e7af9d7dd4e5e296a81cba8a10" }, "mini.nvim": { "branch": "main", "commit": "b5645ac6eefce8e7af9d7dd4e5e296a81cba8a10" },
"nightfly": { "branch": "master", "commit": "90d85c8a094266122fb1fd173e7bcc0cd0efdd49" }, "nightfly": { "branch": "master", "commit": "90d85c8a094266122fb1fd173e7bcc0cd0efdd49" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-dap": { "branch": "master", "commit": "f0dca670fa059eb89dda8869a6310c804241345c" },
"nvim-dap-python": { "branch": "master", "commit": "091e4ae00a12085f9ed4200a3cd04af7179b8a23" },
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
"nvim-lsp-file-operations": { "branch": "master", "commit": "8e7223e138590c1bd9d86d3de810e65939d8b12f" }, "nvim-lsp-file-operations": { "branch": "master", "commit": "8e7223e138590c1bd9d86d3de810e65939d8b12f" },
"nvim-lspconfig": { "branch": "master", "commit": "ce0e625df61be77abe1340fbc9afe9ad39b31dd8" }, "nvim-lspconfig": { "branch": "master", "commit": "ce0e625df61be77abe1340fbc9afe9ad39b31dd8" },
"nvim-tree.lua": { "branch": "master", "commit": "f1b3e6a7eb92da492bd693257367d9256839ed3d" }, "nvim-tree.lua": { "branch": "master", "commit": "f1b3e6a7eb92da492bd693257367d9256839ed3d" },

View File

@@ -0,0 +1,28 @@
local dap = require("dap")
local dapui = require("dapui")
local dap_python = require("dap-python")
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python"
dap_python.setup(path)
-- Setup Mappings
local opts = { noremap = true, silent = true }
opts.desc = "Toggle breakpoint"
vim.keymap.set("n", "<leader>db", "<cmd> DapToggleBreakpoint<CR>", opts)
opts.desc = "Debug Python Run"
vim.keymap.set("n", "<leader>dpr", function()
dap_python.test_method()
end, opts)

View File

@@ -117,6 +117,13 @@ lspconfig["pyright"].setup({
on_attach = on_attach, on_attach = on_attach,
}) })
-- configure python lsp
lspconfig["pylsp"].setup({
capabilities = capabilities,
on_attach = on_attach,
})
-- configure docker server -- configure docker server
lspconfig["dockerls"].setup({ lspconfig["dockerls"].setup({
capabilities = capabilities, capabilities = capabilities,

View File

@@ -14,3 +14,9 @@ require("mason-lspconfig").setup({
}, },
automatic_installation = true, automatic_installation = true,
}) })
require("mason-nvim-dap").setup({
ensure_installed = {
"debugpy", -- python
},
automatic_installation = true,
})

View File

@@ -31,3 +31,4 @@ vim.opt.updatetime = 50
vim.opt.colorcolumn = "" vim.opt.colorcolumn = ""
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = "\\"

View File

@@ -0,0 +1,13 @@
return {
"mfussenegger/nvim-dap",
dependencies = {
-- "theHamsta/nvim-dap-virtual-text",
"rcarriga/nvim-dap-ui",
-- "nvim-telescope/telescope-dap.nvim",
{ "mfussenegger/nvim-dap-python", ft = "python", dependencies = { "mfussenegger/nvim-dap" } },
-- "Pocco81/DAPInstall.nvim"
},
config = function()
require("absolute.after.dap")
end
}

View File

@@ -1,7 +0,0 @@
return {
"dccsillag/magma-nvim",
config = function()
vim.cmd([[ UpdateRemotePlugins ]])
require("absolute.after.magma")
end
}

View File

@@ -2,6 +2,13 @@ return {
'williamboman/mason.nvim', 'williamboman/mason.nvim',
dependencies = { dependencies = {
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
{
"jay-babu/mason-nvim-dap.nvim",
dependencies = {
"mfussenegger/nvim-dap",
}
}
}, },
config = function() config = function()
require("absolute.after.mason") require("absolute.after.mason")

View File

@@ -1,5 +1,3 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>\\", "<cmd>NvimTreeToggle<CR>") -- toggle file explorer vim.keymap.set("n", "<leader>\\", "<cmd>NvimTreeToggle<CR>") -- toggle file explorer