nvim-dap and more keymaps
This commit is contained in:
parent
94a8c813d7
commit
b1c9be6a24
100
init.lua
100
init.lua
|
@ -948,6 +948,104 @@ require('lazy').setup({
|
|||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- { import = 'custom.plugins' },
|
||||
{
|
||||
'mfussenegger/nvim-dap',
|
||||
recommended = true,
|
||||
desc = 'Debugging support. Requires language specific adapters to be configured. (see lang extras)',
|
||||
|
||||
dependencies = {
|
||||
'rcarriga/nvim-dap-ui',
|
||||
'nvim-neotest/nvim-nio',
|
||||
-- virtual text for the debugger
|
||||
{
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
opts = {},
|
||||
},
|
||||
},
|
||||
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" },
|
||||
{ "<F9>", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" },
|
||||
{ "<F5>", function() require("dap").continue() end, desc = "Run/Continue" },
|
||||
{ "<leader>da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" },
|
||||
{ "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" },
|
||||
{ "<leader>dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" },
|
||||
{ "<F11>", function() require("dap").step_into() end, desc = "Step Into" },
|
||||
{ "<leader>dj", function() require("dap").down() end, desc = "Down" },
|
||||
{ "<leader>dk", function() require("dap").up() end, desc = "Up" },
|
||||
{ "<leader>dl", function() require("dap").run_last() end, desc = "Run Last" },
|
||||
{ "<S-F11>", function() require("dap").step_out() end, desc = "Step Out" },
|
||||
{ "<F10>", function() require("dap").step_over() end, desc = "Step Over" },
|
||||
{ "<leader>dP", function() require("dap").pause() end, desc = "Pause" },
|
||||
{ "<leader>dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" },
|
||||
{ "<leader>ds", function() require("dap").session() end, desc = "Session" },
|
||||
{ "<S-F5>", function() require("dap").terminate() end, desc = "Terminate" },
|
||||
{ "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
|
||||
},
|
||||
},
|
||||
{
|
||||
'rcarriga/nvim-dap-ui',
|
||||
dependencies = { 'nvim-neotest/nvim-nio' },
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
|
||||
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
|
||||
},
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
local dap = require 'dap'
|
||||
local mason_registry = require 'mason-registry'
|
||||
local codelldb = mason_registry.get_package 'codelldb'
|
||||
local ext_path = codelldb:get_install_path() .. '/extension/'
|
||||
local codelldb_path = ext_path .. 'adapter/codelldb'
|
||||
local liblldb_path = ext_path .. 'lldb/lib/liblldb.dylib'
|
||||
local dapui = require 'dapui'
|
||||
dapui.setup(opts)
|
||||
dap.listeners.after.event_initialized['dapui_config'] = function()
|
||||
dapui.open {}
|
||||
end
|
||||
dap.listeners.before.event_terminated['dapui_config'] = function()
|
||||
dapui.close {}
|
||||
end
|
||||
dap.listeners.before.event_exited['dapui_config'] = function()
|
||||
dapui.close {}
|
||||
end
|
||||
dap.adapters.lldb = {
|
||||
type = 'executable',
|
||||
command = codelldb_path, -- adjust as needed, must be absolute path
|
||||
name = 'lldb',
|
||||
}
|
||||
|
||||
dap.adapters.cpp = {
|
||||
type = 'executable',
|
||||
attach = {
|
||||
pidProperty = 'pid',
|
||||
pidSelect = 'ask',
|
||||
},
|
||||
command = codelldb_path,
|
||||
env = {
|
||||
LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = 'YES',
|
||||
},
|
||||
name = 'lldb',
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = 'lldb',
|
||||
type = 'cpp',
|
||||
request = 'launch',
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/Binaries/App/App.exe', 'file')
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
externalTerminal = false,
|
||||
stopOnEntry = false,
|
||||
args = {},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
--
|
||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||
-- Or use telescope!
|
||||
|
@ -992,5 +1090,7 @@ require('telescope').setup {
|
|||
},
|
||||
},
|
||||
}
|
||||
vim.fn.sign_define('DapBreakpoint', { text = '🛑', texthl = '', linehl = '', numhl = '' })
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, {})
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
|
Loading…
Reference in New Issue