add nvim-dap

This commit is contained in:
LordMZTE 2022-11-13 21:10:33 +01:00
parent b237481e89
commit 7003744c58
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
4 changed files with 78 additions and 4 deletions

View file

@ -1,10 +1,12 @@
local caps = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
local jdtls = require "jdtls"
local mztenv = require("mzte_nv").jdtls
local caps = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
local bundle_info = mztenv.getBundleInfo()
local dirs = mztenv.getDirs()
require("jdtls").start_or_attach {
jdtls.start_or_attach {
cmd = {
"jdtls",
"-configuration",
@ -38,5 +40,9 @@ require("jdtls").start_or_attach {
on_attach = function(client, _)
-- formatting is handled by clang-format
client.server_capabilities.documentFormattingProvider = false
require("jdtls.setup").add_commands()
jdtls.setup_dap {
hotcodereplace = "auto",
}
end,
}

View file

@ -0,0 +1,58 @@
local map = vim.api.nvim_set_keymap
local dap = require "dap"
local dapui = require "dapui"
dapui.setup {}
dap.adapters.lldb = {
type = "executable",
-- TODO: hardcoding the path here is total dog shit
-- I should implement a dap module in mzte-nv that resolves this.
command = "/usr/bin/lldb-vscode", -- included in lldb package
name = "lldb",
}
dap.configurations.c = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input "Binary: "
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = function()
local parts = {}
for p in vim.split(vim.fn.input "Args: ", " ") do
table.insert(parts, p)
end
return parts
end,
runInTerminal = true,
},
}
dap.configurations.cpp = dap.configurations.c
-- TODO: maybe some way to discover the executable here with cargo n stuff?
dap.configurations.rust = dap.configurations.c
dap.configurations.zig = dap.configurations.c
dap.configurations.java = {
{
type = "java",
request = "attach",
name = "Java attach",
hostName = "127.0.0.1",
port = 5005,
},
}
local opts = { noremap = true, silent = true }
map("n", "fu", [[<cmd>lua require("dapui").toggle()<CR>]], opts)
map("n", "fb", [[<cmd>lua require("dap").toggle_breakpoint()<CR>]], opts)
map("n", "fc", [[<cmd>lua require("dap").continue()<CR>]], opts)
map("n", "fn", [[<cmd>lua require("dap").step_over()<CR>]], opts)
map("n", "fi", [[<cmd>lua require("dap").step_into()<CR>]], opts)
map("n", "fo", [[<cmd>lua require("dap").step_out()<CR>]], opts)

View file

@ -1,3 +1,5 @@
local map = vim.api.nvim_set_keymap
require("nvim-tree").setup {
open_on_setup = not vim.g.started_by_vinput,
open_on_setup_file = false,
@ -11,3 +13,5 @@ require("nvim-tree").setup {
indent_markers = { enable = true },
},
}
map("n", "TT", [[<cmd>NvimTreeToggle<CR>]], { noremap = true, silent = true })

View file

@ -93,7 +93,7 @@ return require("packer").startup(function(use)
use {
"TimUntersberger/neogit",
requires = "nvim-lua/plenary.nvim",
config = pconf "nvim_neogit"
config = pconf "nvim_neogit",
}
use "ron-rs/ron.vim"
@ -169,7 +169,13 @@ return require("packer").startup(function(use)
use {
"stevearc/aerial.nvim",
config = pconf "nvim_aerial"
config = pconf "nvim_aerial",
}
use {
"mfussenegger/nvim-dap",
config = pconf "nvim_dap",
requires = "rcarriga/nvim-dap-ui",
}
cmp_plugins(use)