complete basic config of my neovim

This commit is contained in:
gameloader
2022-10-07 12:15:17 +08:00
parent d783c6fa4f
commit eb733b4c66
10 changed files with 308 additions and 215 deletions

View File

@ -1,27 +0,0 @@
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

39
lua/nvim-dap/cpptools.lua Normal file
View File

@ -0,0 +1,39 @@
-- https://github.com/mfussenegger/nvim-dap/wiki/C-C---Rust-(via--codelldb)
local dap = require("dap")
dap.adapters.cppdbg = {
id = 'cppdbg',
type = 'executable',
command = '/Users/logicluo/.local/share/nvim/mason/packages/cpptools/extension/debugAdapters/bin/OpenDebugAD7',
}
dap.configurations.cpp = {
{
name = "Launch file",
type = "cppdbg",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopAtEntry = true,
},
{
name = 'Attach to gdbserver :1234',
type = 'cppdbg',
request = 'launch',
-- 根据系统需要修改
MIMode = 'lldb',
-- miDebuggerServerAddress = 'localhost:1234',
-- miDebuggerPath = '/usr/bin/gdb',
cwd = '${workspaceFolder}',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
},
}
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp

View File

@ -6,9 +6,9 @@
local dap = require("dap")
local dapui = require("dapui")
-- require("nvim-dap-virtual-text").setup({
-- commented = true,
-- })
require("nvim-dap-virtual-text").setup({
commented = true,
})
vim.fn.sign_define("DapBreakpoint", {
text = "🛑",
@ -42,26 +42,26 @@ dapui.setup({
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"
-- },
layouts = {{
-- 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"
},
{
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.
@ -86,4 +86,4 @@ dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
require("nvim-dap.codelldb").setup()
require("nvim-dap.cpptools")