Adjust neovim key mappings and themes, add initial dap configs
This commit is contained in:
128
src_files/.config/nvim/lua/plugins_lazy/dap.lua
Normal file
128
src_files/.config/nvim/lua/plugins_lazy/dap.lua
Normal file
@@ -0,0 +1,128 @@
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
dap.set_log_level("DEBUG")
|
||||
|
||||
dap.adapters.codelldb = {
|
||||
type = "executable",
|
||||
command = "codelldb",
|
||||
}
|
||||
|
||||
local dapConfigArgsInput = function()
|
||||
return vim.split(vim.fn.input("args: "), " ")
|
||||
end
|
||||
|
||||
local dapConfigProgramSelect = function()
|
||||
local co = coroutine.running()
|
||||
|
||||
require('telescope.pickers').new({}, {
|
||||
prompt_title = "debug executable",
|
||||
finder = require('telescope.finders').new_oneshot_job({
|
||||
"find", ".", "-type", "f", "-perm", "+100", "-exec", "realpath", "{}", "+"
|
||||
}),
|
||||
sorter = require('telescope.sorters').get_fuzzy_file(),
|
||||
attach_mappings = function(prompt_bufnr, _map)
|
||||
local tscopeActions = require('telescope.actions')
|
||||
tscopeActions.select_default:replace(function()
|
||||
tscopeActions.close(prompt_bufnr)
|
||||
local chosenFile = require('telescope.actions.state').get_selected_entry().value
|
||||
coroutine.resume(co, chosenFile)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
}):find()
|
||||
|
||||
return coroutine.yield()
|
||||
end
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "default c/cpp: launch",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
cwd = "${workspaceFolder}",
|
||||
program = dapConfigProgramSelect,
|
||||
stopOnEntry = false,
|
||||
},
|
||||
-- {
|
||||
-- name = "default c/cpp: attach to lldbserver :1234",
|
||||
-- type = "codelldb",
|
||||
-- request = "attach",
|
||||
-- cwd = "${workspaceFolder}",
|
||||
-- program = dapConfigProgramSelect,
|
||||
-- MIMode = "lldb",
|
||||
-- miDebuggerServerAddress = "localhost:1234",
|
||||
-- miDebuggerPath = "/usr/bin/lldb",
|
||||
-- },
|
||||
}
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
dap.configurations.go = {
|
||||
{
|
||||
name = "go: launch",
|
||||
type = "delve",
|
||||
request = "launch",
|
||||
program = dapConfigProgramSelect,
|
||||
args = dapConfigArgsInput,
|
||||
outputMode = "remote",
|
||||
},
|
||||
{
|
||||
name = "go: launch current file",
|
||||
type = "delve",
|
||||
request = "launch",
|
||||
program = "${file}",
|
||||
args = dapConfigArgsInput,
|
||||
outputMode = "remote",
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"nvim-neotest/nvim-nio",
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
local dap_ui = require("dapui")
|
||||
dap_ui.setup()
|
||||
dap.listeners.before.attach.dapui_config = function() dap_ui.open() end
|
||||
dap.listeners.before.launch.dapui_config = function() dap_ui.open() end
|
||||
dap.listeners.before.event_terminated.dapui_config = function() dap_ui.close() end
|
||||
dap.listeners.before.event_exited.dapui_config = function() dap_ui.close() end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim", -- TODO: here, or handle manually outside of neovim?
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"mfussenegger/nvim-dap",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
config = function()
|
||||
require("mason-nvim-dap").setup({
|
||||
ensure_installed = {
|
||||
"codelldb",
|
||||
-- "delve",
|
||||
},
|
||||
automatic_installation = true,
|
||||
handlers = {
|
||||
function(config) require("mason-nvim-dap").default_setup(config) end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
},
|
||||
-- TODO: disabled by default, keymapping to toggle
|
||||
-- config = function()
|
||||
-- local dap_virtual_text = require("nvim-dap-virtual-text")
|
||||
-- dap_virtual_text.setup()
|
||||
-- end,
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user