parent
08218a05ae
commit
b54e1da522
@ -0,0 +1,109 @@
|
||||
local dap_status_ok, dap = pcall(require, 'dap')
|
||||
if not dap_status_ok then
|
||||
vim.notify("nvim-dap plugin not found!")
|
||||
return
|
||||
end
|
||||
|
||||
local dapui_status_ok, dapui = pcall(require, 'dapui')
|
||||
if not dapui_status_ok then
|
||||
vim.notify("nvim-dap plugin not found!")
|
||||
return
|
||||
end
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- adapters
|
||||
----------------------------------------------------------------
|
||||
dap.adapters.lldb =
|
||||
{
|
||||
type = 'executable',
|
||||
command = '/usr/bin/lldb-vscode-14',
|
||||
name = 'lldb'
|
||||
}
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- configuration
|
||||
----------------------------------------------------------------
|
||||
--dap.configurations.uncrustify = {
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
type = 'lldb',
|
||||
name = 'cpp',
|
||||
request = 'launch',
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
stopOnEntry = true,
|
||||
args = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- Load local DAP config, if any
|
||||
require("dap.ext.vscode").load_launchjs(nil, { lldb = { 'cpp'}})
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- Signs
|
||||
----------------------------------------------------------------
|
||||
local dap_breakpoint =
|
||||
{
|
||||
breakpoint = {
|
||||
text = "▪",
|
||||
texthl = "LspDiagnosticsSignError",
|
||||
linehl = "",
|
||||
numhl = "",
|
||||
},
|
||||
rejected = {
|
||||
text = "?",
|
||||
texthl = "LspDiagnosticsSignHint",
|
||||
linehl = "",
|
||||
numhl = "",
|
||||
},
|
||||
stopped = {
|
||||
text = "➡",
|
||||
texthl = "LspDiagnosticsSignInformation",
|
||||
linehl = "DiagnosticUnderlineInfo",
|
||||
numhl = "LspDiagnosticsSignInformation",
|
||||
},
|
||||
}
|
||||
|
||||
vim.fn.sign_define("DapBreakpoint", dap_breakpoint.breakpoint)
|
||||
vim.fn.sign_define("DapBreakpointRejected", dap_breakpoint.rejected)
|
||||
vim.fn.sign_define("DapStopped", dap_breakpoint.stopped)
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- keymapping
|
||||
----------------------------------------------------------------
|
||||
-- keymapping functions
|
||||
local km = require('user/modules/keymapping')
|
||||
|
||||
km.nnoremap('<leader>dc' , ':DapContinue<CR>')
|
||||
km.nnoremap('<leader>dt' , ':DapTerminate<CR>')
|
||||
km.nnoremap('<leader>db' , ':DapToggleBreakpoint<CR>')
|
||||
km.nnoremap('<leader>dp' , ':DapToggleRepl<CR>')
|
||||
km.nnoremap('<leader>ds' , ':DapStepOver<CR>')
|
||||
km.nnoremap('<leader>dS' , ':DapStepInto<CR>')
|
||||
km.nnoremap('<leader>do' , ':DapStepOut<CR>')
|
||||
km.nnoremap('<leader>dr' , ':lua require("dap").run_to_cursor()<CR>')
|
||||
km.nnoremap('<leader>dh' , ':lua require("dap.ui.widgets").hover()<CR>')
|
||||
km.nnoremap('<leader>dj' , ':lua require("dap.ui.widgets").centered_float(require("dap.ui.widgets").scopes)<CR>')
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
-- DAP UI
|
||||
----------------------------------------------------------------
|
||||
dapui.setup()
|
||||
|
||||
km.nnoremap('<leader>du' , ':lua require("dapui").toggle()<CR>')
|
||||
km.nnoremap('<leader>de' , ':lua require("dapui").eval()<CR>')
|
||||
km.nnoremap('<leader>dE' , ':lua require("dapui").eval(vim.fn.input "[Expression] > ")<CR>')
|
||||
--[[
|
||||
C = { "<cmd>lua require'dap'.set_breakpoint(vim.fn.input '[Condition] > ')<cr>", "Conditional Breakpoint" },
|
||||
b = { "<cmd>lua require'dap'.step_back()<cr>", "Step Back" },
|
||||
d = { "<cmd>lua require'dap'.disconnect()<cr>", "Disconnect" },
|
||||
g = { "<cmd>lua require'dap'.session()<cr>", "Get Session" },
|
||||
p = { "<cmd>lua require'dap'.pause.toggle()<cr>", "Pause" },
|
||||
q = { "<cmd>lua require'dap'.close()<cr>", "Quit" },
|
||||
]]
|
Loading…
Reference in new issue