From 8c34fd49624d4edb95ffb765a8a0725a54433039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Mu=C3=B1oz=20Paredes?= Date: Mon, 6 May 2024 09:24:24 +0200 Subject: [PATCH 1/3] delete delve --- lua/kickstart/plugins/debug.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 7a803a9a..19b1355a 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -23,7 +23,7 @@ return { -- Add your own debuggers here 'leoluz/nvim-dap-go', - 'mfussenegger/nvim-dap-python' + 'mfussenegger/nvim-dap-python', }, config = function() local dap = require 'dap' @@ -42,8 +42,7 @@ return { -- online, please don't ask me how to install them :) ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want - 'delve', - 'debugpy' + 'debugpy', }, } @@ -85,10 +84,10 @@ return { dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close - local debugpyPythonPath = require("mason-registry").get_package("debugpy"):get_install_path() .. "/venv/bin/python3" + local debugpyPythonPath = require('mason-registry').get_package('debugpy'):get_install_path() .. '/venv/bin/python3' -- Install golang specific config require('dap-go').setup() - require("dap-python").setup(debugpyPythonPath, {}) + require('dap-python').setup(debugpyPythonPath, {}) end, } From ea7010cac1fca72ef763691614f5f9f2a11ad68b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Mu=C3=B1oz=20Paredes?= Date: Mon, 6 May 2024 13:31:58 +0200 Subject: [PATCH 2/3] Fix debugpy automatic installation --- init.lua | 1 + lua/kickstart/plugins/debug.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 9d2bbe19..6a7e9722 100644 --- a/init.lua +++ b/init.lua @@ -560,6 +560,7 @@ require('lazy').setup({ pyright = {}, ruff = {}, taplo = {}, -- LSP for toml files + debugpy = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 19b1355a..3359999b 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -42,7 +42,7 @@ return { -- online, please don't ask me how to install them :) ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want - 'debugpy', + 'python', }, } From e346668a855c67b52fe9b116cbfbcca8c5cf7292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Mu=C3=B1oz=20Paredes?= Date: Tue, 14 May 2024 09:05:45 +0200 Subject: [PATCH 3/3] Fix debugpy path, load launch.json and keymappings --- init.lua | 3 ++- lua/custom/init.lua | 15 +++++++++------ lua/kickstart/plugins/debug.lua | 15 ++++++++++----- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 6a7e9722..834f4d18 100644 --- a/init.lua +++ b/init.lua @@ -282,8 +282,9 @@ require('lazy').setup({ -- Document existing key chains require('which-key').register { + ['b'] = { name = '[B]uffer', _ = 'which_key_ignore' }, ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ebugger', _ = 'which_key_ignore' }, ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, diff --git a/lua/custom/init.lua b/lua/custom/init.lua index 10bb9e97..b83f6903 100644 --- a/lua/custom/init.lua +++ b/lua/custom/init.lua @@ -12,11 +12,11 @@ vim.keymap.set('i', '', function() vim.cmd.w() end, { desc = '[S]ave file' }) + -- mappings barbar local map = vim.api.nvim_set_keymap local opts = { noremap = true, silent = true } - -- Move to previous/next map('n', '', 'BufferPrevious', opts) map('n', '', 'BufferNext', opts) @@ -41,6 +41,9 @@ map('n', '', 'BufferClose', opts) -- Wipeout buffer -- :BufferWipeout -- Close commands +map('n', 'bcab', 'BufferCloseAllButCurrent', opts) +map('n', 'bcab', 'BufferCloseAllButPinned', opts) +map('n', 'bcar', 'BufferCloseBuffersRight', opts) -- :BufferCloseAllButCurrent -- :BufferCloseAllButPinned -- :BufferCloseAllButCurrentOrPinned @@ -49,8 +52,8 @@ map('n', '', 'BufferClose', opts) -- Magic buffer-picking mode map('n', '', 'BufferPick', opts) -- Sort automatically by... -map('n', 'bb', 'BufferOrderByBufferNumber', opts) -map('n', 'bn', 'BufferOrderByName', opts) -map('n', 'bd', 'BufferOrderByDirectory', opts) -map('n', 'bl', 'BufferOrderByLanguage', opts) -map('n', 'bw', 'BufferOrderByWindowNumber', opts) +map('n', 'bb', 'BufferOrderByBufferNumber', opts) +map('n', 'bn', 'BufferOrderByName', opts) +map('n', 'bd', 'BufferOrderByDirectory', opts) +map('n', 'bl', 'BufferOrderByLanguage', opts) +map('n', 'bw', 'BufferOrderByWindowNumber', opts) \ No newline at end of file diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 3359999b..ea061035 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -51,10 +51,11 @@ return { vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) - vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) - vim.keymap.set('n', 'B', function() + vim.keymap.set('n', 'db', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) + vim.keymap.set('n', '', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) + vim.keymap.set('n', 'dB', function() dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, { desc = 'Debug: Set Breakpoint' }) + end, { desc = 'Debug: Set Breakpoint condition' }) -- Dap UI setup -- For more information, see |:help nvim-dap-ui| @@ -77,6 +78,8 @@ return { }, }, } + -- Load launch.json + require('dap.ext.vscode').load_launchjs() -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. vim.keymap.set('n', '', dapui.toggle, { desc = 'Debug: See last session result.' }) @@ -84,10 +87,12 @@ return { dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close - local debugpyPythonPath = require('mason-registry').get_package('debugpy'):get_install_path() .. '/venv/bin/python3' -- Install golang specific config require('dap-go').setup() - require('dap-python').setup(debugpyPythonPath, {}) + -- Install python specific config + local debugpyPythonPath = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python" + require('dap-python').setup(debugpyPythonPath) + end, }