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("n", " New file", ":ene <BAR> startinsert <CR>"),
button("f", " Find Files", ":Telescope find_files <CR>"), button("f", " Find Files", ":Telescope find_files <CR>"),
button("o", " Recent Files", "<cmd>Telescope oldfiles<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("m", " Bookmarks", ":Telescope marks <CR>"),
button("c", " Neovim config", "<cmd>e ~/.config/nvim/ | cd %:p:h<cr>"), button("c", " Neovim config", "<cmd>e ~/.config/nvim/ | cd %:p:h<cr>"),
button("l", "󰒲 Lazy", "<cmd>Lazy<cr>"), button("l", "󰒲 Lazy", "<cmd>Lazy<cr>"),

View File

@@ -28,35 +28,50 @@ return {
{ "<leader>d<F7>", desc = "Debug step into" }, { "<leader>d<F7>", desc = "Debug step into" },
{ "<leader>d<F8>", desc = "Debug step out" }, { "<leader>d<F8>", desc = "Debug step out" },
}) })
vim.keymap.set('n', '<F5>', function() require('dap').continue() end) vim.keymap.set("n", "<F5>", function()
vim.keymap.set('n', '<F6>', function() require('dap').step_over() end) require("dap").continue()
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) end)
vim.keymap.set({ 'n', 'v' }, '<Leader>dp', function() vim.keymap.set("n", "<F6>", function()
require('dap.ui.widgets').preview() require("dap").step_over()
end) end)
vim.keymap.set('n', '<Leader>df', function() vim.keymap.set("n", "<F7>", function()
local widgets = require('dap.ui.widgets') 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) widgets.centered_float(widgets.frames)
end) end)
vim.keymap.set('n', '<Leader>ds', function() vim.keymap.set("n", "<Leader>ds", function()
local widgets = require('dap.ui.widgets') local widgets = require("dap.ui.widgets")
widgets.centered_float(widgets.scopes) widgets.centered_float(widgets.scopes)
end) end)
end, end,
}) })
-- configure C/C++ -- configure C/C++
-- NOTE: Make sure to install the needed files/exectubles through mason -- NOTE: Make sure to install the needed files/exectubles through mason
local dap = require("dap") local dap = require("dap")
@@ -72,19 +87,23 @@ return {
type = "gdb", type = "gdb",
request = "launch", request = "launch",
program = function() program = function()
local storedValue = vim.g['mydap_program'] local storedValue = vim.g["mydap_program"]
local preFill = vim.fn.getcwd() .. "/" 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") local newValue = vim.fn.input("Path to executable: ", preFill, "file")
vim.g['mydap_program'] = newValue vim.g["mydap_program"] = newValue
return newValue return newValue
end, end,
args = function() args = function()
local storedValue = vim.g['mydap_args'] local storedValue = vim.g["mydap_args"]
local preFill = "" local preFill = ""
if storedValue ~= nil then preFill = storedValue end if storedValue ~= nil then
preFill = storedValue
end
local newValue = vim.fn.input("Arguements: ", preFill) local newValue = vim.fn.input("Arguements: ", preFill)
vim.g['mydap_args'] = newValue vim.g["mydap_args"] = newValue
return newValue return newValue
end, end,
cwd = "${workspaceFolder}", cwd = "${workspaceFolder}",
@@ -95,26 +114,70 @@ return {
type = "gdb", type = "gdb",
request = "attach", request = "attach",
program = function() 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, end,
pid = function() 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 }) return require("dap.utils").pick_process({ filter = name })
end, end,
cwd = '${workspaceFolder}' cwd = "${workspaceFolder}",
}, },
{ {
name = 'Attach to gdbserver :1234', name = "Attach to gdbserver :1234",
type = 'gdb', type = "gdb",
request = 'attach', request = "attach",
target = 'localhost:1234', target = "localhost:1234",
program = function() 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, 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, end,
} }

View File

@@ -42,10 +42,10 @@ return {
"-j4", "-j4",
"--fallback-style=llvm", "--fallback-style=llvm",
}, },
filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "hpp" }, filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "hpp", "h" },
init_options = { -- init_options = {
fallbackFlags = { '-std=c17' }, -- fallbackFlags = { '-std=c17' },
}, -- },
handlers = handlers, handlers = handlers,
}) })

View File

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