make file config

This commit is contained in:
Jakub Kluwa 2025-10-08 23:08:12 +02:00
parent 3399fad748
commit 81505dbd92
3 changed files with 16 additions and 14 deletions

View File

@ -100,7 +100,7 @@ vim.g.have_nerd_font = true
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true
vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'
@ -192,6 +192,8 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
vim.keymap.set('n', '<leader>m', ':make<CR>', { noremap = true, silent = true, desc = 'Run make' })
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })

View File

@ -1,12 +1 @@
local dap = require 'dap'
local dapui = require 'dapui'
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Start/Continue debug' })
vim.keymap.set('n', '<F10>', dap.step_over, { desc = 'Step over' })
vim.keymap.set('n', '<F11>', dap.step_into, { desc = 'Step into' })
vim.keymap.set('n', '<F12>', dap.step_out, { desc = 'Step out' })
vim.keymap.set('n', '<Leader>b', dap.toggle_breakpoint, { desc = 'Toggle breakpoint' })
vim.keymap.set('n', '<Leader>B', function()
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end, { desc = 'Set conditional breakpoint' })
vim.keymap.set('n', '<Leader>du', dapui.toggle, { desc = 'Toggle DAP UI' })

View File

@ -38,11 +38,22 @@ return {
dap.configurations.cpp = {
{
name = 'Launch file',
name = 'Launch C++ program (with make)',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
local result = vim.fn.system 'make'
-- Print make output (optional)
print(result)
if vim.v.shell_error ~= 0 then
error '❌ Build failed! Check your Makefile.'
else
print '✅ Build successful!'
end
return vim.fn.getcwd() .. '/main'
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,