feat(plugins): Add nvim-dap and overseer

Added:
  - [nvim-dap](https://github.com/mfussenegger/nvim-dap)
  - [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui)
  - [overseer.nvim](https://github.com/stevearc/overseer.nvim)
Removed:
  - NeoTree `<leader>o` keymap (it's now used for overseer)
This commit is contained in:
Jiří Štefka 2024-09-23 23:22:44 +02:00
parent 65dea4ed80
commit e256516fe7
Signed by: jiriks74
GPG key ID: 1D5E30D3DB2264DE
6 changed files with 153 additions and 17 deletions
nvim/ftplugin

View file

@ -3,9 +3,9 @@ if vim.fn.executable('clangd') ~= 1 then
return
end
require'lspconfig'.clangd.setup{}
-- require'lspconfig'.clangd.setup{}
--[[ local root_files = {
local root_files = {
'compile_commands.json',
'.vscode',
'.git',
@ -16,9 +16,14 @@ vim.lsp.start {
cmd = { 'clangd' },
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
capabilities = require('user.lsp').make_client_capabilities(),
} ]]
}
local dap = require("dap")
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
if require('user.file_exists').file_exists(vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]) .. "/.vscode/launch.json") then
require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp", "asm" } })
@ -31,14 +36,40 @@ dap.adapters.gdb = {
}
dap.configurations.c = {
-- {
-- name = "Launch",
-- type = "gdb",
-- request = "launch",
-- program = function()
-- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
-- end,
-- cwd = "${workspaceFolder}",
-- stopAtBeginningOfMainSubprogram = false,
-- },
{
name = "Launch",
name = "Launch an executable",
type = "gdb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = "${workspaceFolder}",
program = function()
return coroutine.create(function(coro)
local opts = {}
pickers
.new(opts, {
prompt_title = "Path to executable",
finder = finders.new_oneshot_job({ "fd", "--hidden", "--no-ignore", "--type", "x" }, {}),
sorter = conf.generic_sorter(opts),
attach_mappings = function(buffer_number)
actions.select_default:replace(function()
actions.close(buffer_number)
coroutine.resume(coro, action_state.get_selected_entry()[1])
end)
return true
end,
})
:find()
end)
end,
stopAtBeginningOfMainSubprogram = false,
},
}