From 989cbecead3cc0639b31ae0fe7c19502f0db4b90 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Mon, 5 Feb 2024 12:35:30 +0100 Subject: [PATCH] debug --- lua/custom/chadrc.lua | 2 +- lua/custom/init.lua | 2 +- lua/custom/mappings.lua | 81 +++++++++++++++++++++++++++++++---------- lua/custom/plugins.lua | 20 ++++++++++ 4 files changed, 83 insertions(+), 22 deletions(-) diff --git a/lua/custom/chadrc.lua b/lua/custom/chadrc.lua index 074bd3e..73175d9 100644 --- a/lua/custom/chadrc.lua +++ b/lua/custom/chadrc.lua @@ -5,7 +5,7 @@ local M = {} local highlights = require "custom.highlights" M.ui = { - theme = "kanagawa", + theme = "chadracula", theme_toggle = { "kanagawa", "chadracula" }, hl_override = highlights.override, diff --git a/lua/custom/init.lua b/lua/custom/init.lua index 9aeb16a..2c2ecd4 100644 --- a/lua/custom/init.lua +++ b/lua/custom/init.lua @@ -67,7 +67,7 @@ opt.foldlevel = 10 -- start with all folds open -- Editor UI -- === -vim.o.guifont = "FiraCode Nerd Font:h27" +vim.o.guifont = "FiraCode Nerd Font:h22" opt.termguicolors = true opt.shortmess = "xsTOInfFitloCaAs" opt.showmode = true -- Show mode in cmd window diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua index e6047d0..810955d 100644 --- a/lua/custom/mappings.lua +++ b/lua/custom/mappings.lua @@ -226,89 +226,89 @@ M.toggleterm = { plugin = true, n = { [""] = { - "exe v:count1 \"ToggleTerm direction=float\"", + 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=float\"", + 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=tab\"", + 'exe v:count1 "ToggleTerm direction=tab"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=horizontal\"", + 'exe v:count1 "ToggleTerm direction=horizontal"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=vertical\"", + 'exe v:count1 "ToggleTerm direction=vertical"', "toggle terminal", }, }, i = { [""] = { - "exe v:count1 \"ToggleTerm direction=float\"", + 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=float\"", + 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=tab\"", + 'exe v:count1 "ToggleTerm direction=tab"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=horizontal\"", + 'exe v:count1 "ToggleTerm direction=horizontal"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=vertical\"", + 'exe v:count1 "ToggleTerm direction=vertical"', "toggle terminal", }, }, t = { [""] = { - "exe v:count1 \"ToggleTerm direction=float\"", + 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=float\"", + 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=tab\"", + 'exe v:count1 "ToggleTerm direction=tab"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=horizontal\"", + 'exe v:count1 "ToggleTerm direction=horizontal"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=vertical\"", + 'exe v:count1 "ToggleTerm direction=vertical"', "toggle terminal", }, }, x = { [""] = { - "exe v:count1 \"ToggleTerm direction=float\"", + 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=float\"", + 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=tab\"", + 'exe v:count1 "ToggleTerm direction=tab"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=horizontal\"", + 'exe v:count1 "ToggleTerm direction=horizontal"', "toggle terminal", }, [""] = { - "exe v:count1 \"ToggleTerm direction=vertical\"", + 'exe v:count1 "ToggleTerm direction=vertical"', "toggle terminal", }, }, @@ -545,4 +545,45 @@ M.goto_preview = { }, } +M.debug = { + plugin = true, + n = { + ["db"] = { + function() + require("dap").toggle_breakpoint() + end, + "toggle breakpoint", + noremap = true, + }, + ["dc"] = { + function() + require("dap").continue() + end, + "debug continue", + noremap = true, + }, + ["ds"] = { + function() + require("dap").step_over() + end, + "debug step over", + noremap = true, + }, + ["di"] = { + function() + require("dap").step_into() + end, + "debug step into", + noremap = true, + }, + ["dr"] = { + function() + require("dap").repl.open() + end, + "debug open repl", + noremap = true, + }, + }, +} + return M diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua index 564dd2f..ae25d30 100644 --- a/lua/custom/plugins.lua +++ b/lua/custom/plugins.lua @@ -716,6 +716,26 @@ local plugins = { require("icon-picker").setup { disable_legacy_commands = true } end, }, + { + "mfussenegger/nvim-dap", + init = function() + require("core.utils").load_mappings "debug" + end, + config = function() + local dap = require "dap" + dap.configurations.c = { + { + name = "Launch", + type = "gdb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + }, + } + end, + }, } return plugins