chore: updated december2025 config improvements

This commit is contained in:
Ward Truyen
2025-12-28 23:39:20 +01:00
parent 8aa2654e20
commit 22688bae66
4 changed files with 182 additions and 117 deletions

View File

@@ -31,7 +31,8 @@ return {
button("n", " New file", ":ene <BAR> startinsert <CR>"),
button("f", " Find Files", ":Telescope find_files <CR>"),
button("o", " Recent Files", "<cmd>Telescope oldfiles<cr>"),
button("t", "Find text", ":Telescope live_grep <CR>"),
button("t", "Terminal", ":terminal<CR>i"),
button("s", "S Find text/string", ":Telescope live_grep <CR>"),
button("m", " Bookmarks", ":Telescope marks <CR>"),
button("c", " Neovim config", "<cmd>e ~/.config/nvim/ | cd %:p:h<cr>"),
button("l", "󰒲 Lazy", "<cmd>Lazy<cr>"),

View File

@@ -28,35 +28,50 @@ return {
{ "<leader>d<F7>", desc = "Debug step into" },
{ "<leader>d<F8>", desc = "Debug step out" },
})
vim.keymap.set('n', '<F5>', function() require('dap').continue() end)
vim.keymap.set('n', '<F6>', function() require('dap').step_over() end)
vim.keymap.set('n', '<F7>', function() require('dap').step_into() end)
vim.keymap.set('n', '<F8>', function() require('dap').step_out() end)
vim.keymap.set('n', '<Leader>db', function() require('dap').toggle_breakpoint() end)
vim.keymap.set('n', '<Leader>dB', function() require('dap').set_breakpoint() end)
vim.keymap.set('n', '<Leader>dm',
function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end)
vim.keymap.set('n', '<Leader>dr', function() require('dap').repl.open() end)
vim.keymap.set('n', '<Leader>dl', function() require('dap').run_last() end)
vim.keymap.set({ 'n', 'v' }, '<Leader>dh', function()
require('dap.ui.widgets').hover()
vim.keymap.set("n", "<F5>", function()
require("dap").continue()
end)
vim.keymap.set({ 'n', 'v' }, '<Leader>dp', function()
require('dap.ui.widgets').preview()
vim.keymap.set("n", "<F6>", function()
require("dap").step_over()
end)
vim.keymap.set('n', '<Leader>df', function()
local widgets = require('dap.ui.widgets')
vim.keymap.set("n", "<F7>", function()
require("dap").step_into()
end)
vim.keymap.set("n", "<F8>", function()
require("dap").step_out()
end)
vim.keymap.set("n", "<Leader>db", function()
require("dap").toggle_breakpoint()
end)
vim.keymap.set("n", "<Leader>dB", function()
require("dap").set_breakpoint()
end)
vim.keymap.set("n", "<Leader>dm", function()
require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: "))
end)
vim.keymap.set("n", "<Leader>dr", function()
require("dap").repl.open()
end)
vim.keymap.set("n", "<Leader>dl", function()
require("dap").run_last()
end)
vim.keymap.set({ "n", "v" }, "<Leader>dh", function()
require("dap.ui.widgets").hover()
end)
vim.keymap.set({ "n", "v" }, "<Leader>dp", function()
require("dap.ui.widgets").preview()
end)
vim.keymap.set("n", "<Leader>df", function()
local widgets = require("dap.ui.widgets")
widgets.centered_float(widgets.frames)
end)
vim.keymap.set('n', '<Leader>ds', function()
local widgets = require('dap.ui.widgets')
vim.keymap.set("n", "<Leader>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")
@@ -72,19 +87,23 @@ return {
type = "gdb",
request = "launch",
program = function()
local storedValue = vim.g['mydap_program']
local storedValue = vim.g["mydap_program"]
local preFill = vim.fn.getcwd() .. "/"
if storedValue ~= nil then preFill = storedValue end
if storedValue ~= nil then
preFill = storedValue
end
local newValue = vim.fn.input("Path to executable: ", preFill, "file")
vim.g['mydap_program'] = newValue
vim.g["mydap_program"] = newValue
return newValue
end,
args = function()
local storedValue = vim.g['mydap_args']
local storedValue = vim.g["mydap_args"]
local preFill = ""
if storedValue ~= nil then preFill = storedValue end
if storedValue ~= nil then
preFill = storedValue
end
local newValue = vim.fn.input("Arguements: ", preFill)
vim.g['mydap_args'] = newValue
vim.g["mydap_args"] = newValue
return newValue
end,
cwd = "${workspaceFolder}",
@@ -95,26 +114,70 @@ return {
type = "gdb",
request = "attach",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
pid = function()
local name = vim.fn.input('Executable name (filter): ')
local name = vim.fn.input("Executable name (filter): ")
return require("dap.utils").pick_process({ filter = name })
end,
cwd = '${workspaceFolder}'
cwd = "${workspaceFolder}",
},
{
name = 'Attach to gdbserver :1234',
type = 'gdb',
request = 'attach',
target = 'localhost:1234',
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')
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = '${workspaceFolder}'
cwd = "${workspaceFolder}",
},
}
dap.configurations.c = dap.configurations.cpp
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,
}

View File

@@ -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,
})

View File

@@ -28,6 +28,7 @@ return {
{ "<leader>x", group = "Plugins" },
{ "<leader>xl", vim.cmd.Lazy, desc = "Lazy" },
{ "<leader>xw", vim.cmd.WhichKey, desc = "Which-key" },
{ "<leader>xa", vim.cmd.Alpha, desc = "Alpha splash" },
{ "<leader>w", function()
wk.show({ keys = "<c-w>" })
end,