Upgrading from vim
to neovim
(on the mac).
Part of this is to get the DAP debugger working from inside neovim.
I have "Lazy" installed to handle plugins.
I found that the best DAP adapter for g++ (Clang on the Mac) is the llvm lldb-dap
which makes sense. I could not find any instructions on how to install it so I came up with the following.
Note this is the file used by "Lazy" to install "nvim-dap".
return {
"mfussenegger/nvim-dap",
config = function(_, _)
if (vim.loop.os_uname().sysname == "Darwin") then
local handle = io.popen("brew --prefix")
local output = handle:read("*a")
local install = string.gsub(output .. "/opt/llvm/bin/lldb-dap", "\n", "")
vim.print("lldb: " .. install)
local exists=io.open(install,"r")
if exists==nil then
vim.print("Could not find lldb-dap. Use `brew install llvm` to install")
else
io.close(exists)
local dap = require('dap')
dap.adapters.lldb = {
type = 'executable',
command = install,
name = 'lldb'
}
dap.configurations.cpp = {
{
name = 'Launch',
type = 'lldb',
request = 'launch',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
},
}
end
end
end,
}
Note: I am not familiar with the Lua language so this is from scraps I found around the internet. Any advice on improving the code would be appreciated.
Also any advice on how neovim plugins work would also be helpful.