From 4a88bb5bcf727e771bb092cedddcf39b9c185514 Mon Sep 17 00:00:00 2001 From: kenyzum Date: Thu, 26 Feb 2026 15:54:20 +0100 Subject: [PATCH] update --- init.lua | 2 ++ lazy-lock.json | 3 +++ lua/plugins/dap.lua | 53 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 lua/plugins/dap.lua diff --git a/init.lua b/init.lua index cb09597..1b42722 100644 --- a/init.lua +++ b/init.lua @@ -2,6 +2,8 @@ vim.cmd("set expandtab") vim.cmd("set tabstop=2") vim.cmd("set softtabstop=2") vim.cmd("set shiftwidth=2") +vim.opt.number = true +vim.opt.relativenumber = true vim.g.mapleader = " " local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" diff --git a/lazy-lock.json b/lazy-lock.json index ae76781..a6e8934 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -12,7 +12,10 @@ "neo-tree.nvim": { "branch": "v3.x", "commit": "9d6826582a3e8c84787bd7355df22a2812a1ad59" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" }, + "nvim-dap": { "branch": "master", "commit": "b516f20b487b0ac6a281e376dfac1d16b5040041" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, "nvim-lspconfig": { "branch": "master", "commit": "f386df19b145607a33885b6110ef5c04faae42cb" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-treesitter": { "branch": "main", "commit": "957f86ae3f049ab6681ed64c05b05768fcaed0d2" }, "nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua new file mode 100644 index 0000000..986e372 --- /dev/null +++ b/lua/plugins/dap.lua @@ -0,0 +1,53 @@ +-- plugins/dap.lua +return { + { + "mfussenegger/nvim-dap", + dependencies = { + "rcarriga/nvim-dap-ui", + "nvim-neotest/nvim-nio", -- wymagane przez dap-ui + }, + config = function() + local dap = require("dap") + local dapui = require("dapui") + + -- konfiguracja codelldb dla C++ + dap.adapters.codelldb = { + type = "server", + port = "${port}", + executable = { + command = vim.fn.stdpath("data") .. "/mason/bin/codelldb", + args = { "--port", "${port}" }, + } + } + + dap.configurations.cpp = { + { + name = "Launch", + type = "codelldb", + request = "launch", + program = function() + -- pyta o ścieżkę do binarki przed debugowaniem + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/build/", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = true, + stopAtEntry = true, + } + } + + -- otwiera/zamyka UI automatycznie + dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() end + dap.listeners.before.event_terminated["dapui_config"] = function() dapui.close() end + + -- bindy + vim.keymap.set("n", "", dap.continue) -- start/continue + vim.keymap.set("n", "", dap.step_over) -- następna linia + vim.keymap.set("n", "", dap.step_into) -- wejdź w funkcję + vim.keymap.set("n", "", dap.step_out) -- wyjdź z funkcji + vim.keymap.set("n", "b", dap.toggle_breakpoint) -- breakpoint + vim.keymap.set("n", "du", dapui.toggle) -- toggle UI + + dapui.setup() + end + } +}