first commit

This commit is contained in:
game-loader
2022-10-06 17:40:06 +08:00
commit 42dda177d6
26 changed files with 1236 additions and 0 deletions

27
lua/nvim-dap/codelldb.lua Normal file
View File

@ -0,0 +1,27 @@
local M = {}
function M.setup()
local dap = require('dap')
dap.adapters.codelldb = {
type = 'server',
port = "${port}",
executable = {
command = '/home/ubuntu/.local/share/nvim/mason/packages/codelldb/codelldb',
args = {"--port", "${port}"}
}
}
dap.configurations.cpp = {
{
name = "Launch file",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = true,
},
}
end
return M

89
lua/nvim-dap/init.lua Normal file
View File

@ -0,0 +1,89 @@
-- local dap_install = require("dap-install")
-- dap_install.setup({
-- installation_path = vim.fn.stdpath("data") .. "/dapinstall/",
-- })
local dap = require("dap")
local dapui = require("dapui")
-- require("nvim-dap-virtual-text").setup({
-- commented = true,
-- })
vim.fn.sign_define("DapBreakpoint", {
text = "🛑",
texthl = "LspDiagnosticsSignError",
linehl = "",
numhl = "",
})
vim.fn.sign_define("DapStopped", {
text = "",
texthl = "LspDiagnosticsSignInformation",
linehl = "DiagnosticUnderlineInfo",
numhl = "LspDiagnosticsSignInformation",
})
vim.fn.sign_define("DapBreakpointRejected", {
text = "",
texthl = "LspDiagnosticsSignHint",
linehl = "",
numhl = "",
})
dapui.setup({
icons = { expanded = "", collapsed = "" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "o", "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
-- sidebar = {
-- -- You can change the order of elements in the sidebar
-- elements = {
-- -- Provide as ID strings or tables with "id" and "size" keys
-- {
-- id = "scopes",
-- size = 0.25, -- Can be float or integer > 1
-- },
-- { id = "breakpoints", size = 0.25 },
-- { id = "stacks", size = 0.25 },
-- { id = "watches", size = 00.25 },
-- },
-- size = 40,
-- position = "left", -- Can be "left", "right", "top", "bottom"
-- },
-- tray = {
-- elements = { "repl" },
-- size = 10,
-- position = "bottom", -- Can be "left", "right", "top", "bottom"
-- },
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
},
}) -- use default
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
require("nvim-dap.codelldb").setup()