feat: basic nvim-dap setup
This commit is contained in:
parent
09e5cd383f
commit
8f0b088886
@ -14,5 +14,29 @@ vim.lsp.start {
|
||||
cmd = { 'clangd' },
|
||||
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
||||
capabilities = require('user.lsp').make_client_capabilities(),
|
||||
-- capabilities = { offsetEncoding = "utf-8" },
|
||||
}
|
||||
|
||||
local dap = require("dap")
|
||||
|
||||
if require('user.file_exists').file_exists(vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]) .. "/.vscode/launch.json") then
|
||||
require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp", "asm" } })
|
||||
end
|
||||
|
||||
dap.adapters.gdb = {
|
||||
type = "executable",
|
||||
command = "gdb",
|
||||
args = { "-i", "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}",
|
||||
stopAtBeginningOfMainSubprogram = false,
|
||||
},
|
||||
}
|
||||
|
8
nvim/lua/user/file_exists.lua
Normal file
8
nvim/lua/user/file_exists.lua
Normal file
@ -0,0 +1,8 @@
|
||||
local F = {}
|
||||
|
||||
function F.file_exists(name)
|
||||
local f=io.open(name,"r")
|
||||
if f~=nil then io.close(f) return true else return false end
|
||||
end
|
||||
|
||||
return F
|
5
nvim/plugin/dap.lua
Normal file
5
nvim/plugin/dap.lua
Normal file
@ -0,0 +1,5 @@
|
||||
if vim.g.did_load_dap_plugin then
|
||||
return
|
||||
end
|
||||
vim.g.did_load_dap_plugin = true
|
||||
|
@ -6,6 +6,7 @@ vim.g.did_load_plugins_plugin = true
|
||||
-- many plugins annoyingly require a call to a 'setup' function to be loaded,
|
||||
-- even with default configs
|
||||
|
||||
require("dapui").setup()
|
||||
require("copilot_cmp").setup()
|
||||
require('nvim-surround').setup()
|
||||
require('which-key').setup()
|
||||
|
Loading…
x
Reference in New Issue
Block a user