From 22688bae66aa98e5a5d32bbef09c4ce9d403edac Mon Sep 17 00:00:00 2001 From: Ward Truyen Date: Sun, 28 Dec 2025 23:39:20 +0100 Subject: [PATCH] chore: updated december2025 config improvements --- lua/ward/plugins/alpha-dashboard.lua | 3 +- lua/ward/plugins/dap.lua | 287 ++++++++++++++++----------- lua/ward/plugins/lsp-config.lua | 8 +- lua/ward/plugins/which-key.lua | 1 + 4 files changed, 182 insertions(+), 117 deletions(-) diff --git a/lua/ward/plugins/alpha-dashboard.lua b/lua/ward/plugins/alpha-dashboard.lua index 5fd0356..57da37d 100644 --- a/lua/ward/plugins/alpha-dashboard.lua +++ b/lua/ward/plugins/alpha-dashboard.lua @@ -31,7 +31,8 @@ return { button("n", " New file", ":ene startinsert "), button("f", " Find Files", ":Telescope find_files "), button("o", " Recent Files", "Telescope oldfiles"), - button("t", " Find text", ":Telescope live_grep "), + button("t", " Terminal", ":terminali"), + button("s", "S Find text/string", ":Telescope live_grep "), button("m", " Bookmarks", ":Telescope marks "), button("c", " Neovim config", "e ~/.config/nvim/ | cd %:p:h"), button("l", "󰒲 Lazy", "Lazy"), diff --git a/lua/ward/plugins/dap.lua b/lua/ward/plugins/dap.lua index 8a8b1fe..a032da5 100644 --- a/lua/ward/plugins/dap.lua +++ b/lua/ward/plugins/dap.lua @@ -1,120 +1,183 @@ -- NOTE: Debug Adapter Protocol -- URL: https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation return { - "mfussenegger/nvim-dap", - config = function() - -- NOTE: Check out this for guide - vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" }) + "mfussenegger/nvim-dap", + config = function() + -- NOTE: Check out this for guide + vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" }) - -- These dap keybinds only load when an LSP is attatched to the buffer. - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserDapConfig", {}), - callback = function(event) - local wk = require("which-key") - wk.add({ - { "d", group = "DAP" }, - { "dd", desc = "Toggle DAP UI" }, - { "db", desc = "Toggle breakpoint" }, - { "dB", desc = "Set breakpoint" }, - { "dm", desc = "message point" }, - { "dr", desc = "Open repl" }, - { "dl", desc = "Run last" }, - { "dh", desc = "Hover widgets" }, - { "dp", desc = "Preview widgets" }, - { "df", desc = "Float frames" }, - { "ds", desc = "Float scopes" }, - { "d", desc = "Debug start/continue" }, - { "d", desc = "Debug step over" }, - { "d", desc = "Debug step into" }, - { "d", desc = "Debug step out" }, - }) - vim.keymap.set('n', '', function() require('dap').continue() end) - vim.keymap.set('n', '', function() require('dap').step_over() end) - vim.keymap.set('n', '', function() require('dap').step_into() end) - vim.keymap.set('n', '', function() require('dap').step_out() end) - vim.keymap.set('n', 'db', function() require('dap').toggle_breakpoint() end) - vim.keymap.set('n', 'dB', function() require('dap').set_breakpoint() end) - vim.keymap.set('n', 'dm', - function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end) - vim.keymap.set('n', 'dr', function() require('dap').repl.open() end) - vim.keymap.set('n', 'dl', function() require('dap').run_last() end) - vim.keymap.set({ 'n', 'v' }, 'dh', function() - require('dap.ui.widgets').hover() - end) - vim.keymap.set({ 'n', 'v' }, 'dp', function() - require('dap.ui.widgets').preview() - end) - vim.keymap.set('n', 'df', function() - local widgets = require('dap.ui.widgets') - widgets.centered_float(widgets.frames) - end) - vim.keymap.set('n', 'ds', function() - local widgets = require('dap.ui.widgets') - widgets.centered_float(widgets.scopes) - end) - end, - }) + -- These dap keybinds only load when an LSP is attatched to the buffer. + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserDapConfig", {}), + callback = function(event) + local wk = require("which-key") + wk.add({ + { "d", group = "DAP" }, + { "dd", desc = "Toggle DAP UI" }, + { "db", desc = "Toggle breakpoint" }, + { "dB", desc = "Set breakpoint" }, + { "dm", desc = "message point" }, + { "dr", desc = "Open repl" }, + { "dl", desc = "Run last" }, + { "dh", desc = "Hover widgets" }, + { "dp", desc = "Preview widgets" }, + { "df", desc = "Float frames" }, + { "ds", desc = "Float scopes" }, + { "d", desc = "Debug start/continue" }, + { "d", desc = "Debug step over" }, + { "d", desc = "Debug step into" }, + { "d", desc = "Debug step out" }, + }) + vim.keymap.set("n", "", function() + require("dap").continue() + end) + vim.keymap.set("n", "", function() + require("dap").step_over() + end) + vim.keymap.set("n", "", function() + require("dap").step_into() + end) + vim.keymap.set("n", "", function() + require("dap").step_out() + end) + vim.keymap.set("n", "db", function() + require("dap").toggle_breakpoint() + end) + vim.keymap.set("n", "dB", function() + require("dap").set_breakpoint() + end) + vim.keymap.set("n", "dm", function() + require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: ")) + end) + vim.keymap.set("n", "dr", function() + require("dap").repl.open() + end) + vim.keymap.set("n", "dl", function() + require("dap").run_last() + end) + vim.keymap.set({ "n", "v" }, "dh", function() + require("dap.ui.widgets").hover() + end) + vim.keymap.set({ "n", "v" }, "dp", function() + require("dap.ui.widgets").preview() + end) + vim.keymap.set("n", "df", function() + local widgets = require("dap.ui.widgets") + widgets.centered_float(widgets.frames) + end) + vim.keymap.set("n", "ds", function() + local widgets = require("dap.ui.widgets") + widgets.centered_float(widgets.scopes) + end) + end, + }) + -- configure C/C++ + -- NOTE: Make sure to install the needed files/exectubles through mason + local dap = require("dap") + dap.adapters.gdb = { + type = "executable", + command = "gdb", + args = { "--interpreter=dap", "-eval-command", "set print pretty on" }, + } + dap.configurations.cpp = { + { + name = "Launch", + type = "gdb", + request = "launch", + program = function() + local storedValue = vim.g["mydap_program"] + local preFill = vim.fn.getcwd() .. "/" + if storedValue ~= nil then + preFill = storedValue + end + local newValue = vim.fn.input("Path to executable: ", preFill, "file") + vim.g["mydap_program"] = newValue + return newValue + end, + args = function() + local storedValue = vim.g["mydap_args"] + local preFill = "" + if storedValue ~= nil then + preFill = storedValue + end + local newValue = vim.fn.input("Arguements: ", preFill) + vim.g["mydap_args"] = newValue + return newValue + end, + cwd = "${workspaceFolder}", + stopAtBeginningOfMainSubprogram = false, + }, + { + name = "Select and attach to process", + type = "gdb", + request = "attach", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + pid = function() + local name = vim.fn.input("Executable name (filter): ") + return require("dap.utils").pick_process({ filter = name }) + end, + cwd = "${workspaceFolder}", + }, + { + name = "Attach to gdbserver :1234", + type = "gdb", + request = "attach", + target = "localhost:1234", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + }, + } - -- configure C/C++ - -- NOTE: Make sure to install the needed files/exectubles through mason - local dap = require("dap") - dap.adapters.gdb = { - type = "executable", - command = "gdb", - args = { "--interpreter=dap", "-eval-command", "set print pretty on" }, - } - - dap.configurations.cpp = { - { - name = "Launch", - type = "gdb", - request = "launch", - program = function() - local storedValue = vim.g['mydap_program'] - local preFill = vim.fn.getcwd() .. "/" - if storedValue ~= nil then preFill = storedValue end - local newValue = vim.fn.input("Path to executable: ", preFill, "file") - vim.g['mydap_program'] = newValue - return newValue - end, - args = function() - local storedValue = vim.g['mydap_args'] - local preFill = "" - if storedValue ~= nil then preFill = storedValue end - local newValue = vim.fn.input("Arguements: ", preFill) - vim.g['mydap_args'] = newValue - return newValue - end, - cwd = "${workspaceFolder}", - stopAtBeginningOfMainSubprogram = false, - }, - { - name = "Select and attach to process", - type = "gdb", - request = "attach", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - pid = function() - local name = vim.fn.input('Executable name (filter): ') - return require("dap.utils").pick_process({ filter = name }) - end, - cwd = '${workspaceFolder}' - }, - { - name = 'Attach to gdbserver :1234', - type = 'gdb', - request = 'attach', - target = 'localhost:1234', - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - cwd = '${workspaceFolder}' - }, - } - - dap.configurations.c = dap.configurations.cpp - end, + dap.configurations.c = { + { + name = "Launch", + type = "gdb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + args = function() + local storedValue = vim.g["mydap_args"] + local preFill = "" + if storedValue ~= nil then + preFill = storedValue + end + local newValue = vim.fn.input("Arguements: ", preFill) + vim.g["mydap_args"] = newValue + return newValue + end, + cwd = "${workspaceFolder}", + stopAtBeginningOfMainSubprogram = false, + }, + { + name = "Select and attach to process", + type = "gdb", + request = "attach", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + pid = function() + local name = vim.fn.input("Executable name (filter): ") + return require("dap.utils").pick_process({ filter = name }) + end, + cwd = "${workspaceFolder}", + }, + { + name = "Attach to gdbserver :1234", + type = "gdb", + request = "attach", + target = "localhost:1234", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + }, + } + end, } diff --git a/lua/ward/plugins/lsp-config.lua b/lua/ward/plugins/lsp-config.lua index 88a16b4..247bd6a 100644 --- a/lua/ward/plugins/lsp-config.lua +++ b/lua/ward/plugins/lsp-config.lua @@ -42,10 +42,10 @@ return { "-j4", "--fallback-style=llvm", }, - filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "hpp" }, - init_options = { - fallbackFlags = { '-std=c17' }, - }, + filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "hpp", "h" }, + -- init_options = { + -- fallbackFlags = { '-std=c17' }, + -- }, handlers = handlers, }) diff --git a/lua/ward/plugins/which-key.lua b/lua/ward/plugins/which-key.lua index 5c10517..c1b4854 100644 --- a/lua/ward/plugins/which-key.lua +++ b/lua/ward/plugins/which-key.lua @@ -28,6 +28,7 @@ return { { "x", group = "Plugins" }, { "xl", vim.cmd.Lazy, desc = "Lazy" }, { "xw", vim.cmd.WhichKey, desc = "Which-key" }, + { "xa", vim.cmd.Alpha, desc = "Alpha splash" }, { "w", function() wk.show({ keys = "" }) end,