nvim: Migrated all dap-related things to their own file

This commit is contained in:
PowerUser64 2021-09-28 01:52:37 -07:00
parent 4f55c742ad
commit 7c747cbbc1
4 changed files with 162 additions and 82 deletions

View file

@ -17,9 +17,7 @@ M.lspinstall = function() --
require'lspconfig'[server].setup{}
end
end
setup_servers()
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require'lspinstall'.post_install_hook = function ()
setup_servers() -- reload installed servers
@ -83,6 +81,18 @@ M.treesitter = function()
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
-- How to read these next keybinds
-- first character:
-- [ means previous
-- ] means next
-- second character:
-- m means function beginning
-- M means function end
-- OR
-- both the same means start in that direction
-- ex: [[ means previous start
-- both in opposite directions means end in that way
-- ex: [] means previous end
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
@ -109,7 +119,6 @@ M.cmp = function()
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
@ -153,7 +162,6 @@ M.cmp = function()
format = function(entry, vim_item)
-- fancy icons and a name of kind
vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. " " .. vim_item.kind
-- set a name for each source
vim_item.menu = ({
path = "(Path)",
@ -226,58 +234,6 @@ M.lspconfig = function()
end
end -- <<<
-- DAP: Debug Adapter Protocol >>>
M.dap = function()
-- keybinds
vim.cmd [[
" Debugger movement
nnoremap <silent> <leader>d<space> <cmd>lua require'dap'.continue()<CR>
nnoremap <silent> <leader>dj <cmd>lua require'dap'.step_over()<CR>
nnoremap <silent> <leader>dl <cmd>lua require'dap'.step_into()<CR>
nnoremap <silent> <leader>dh <cmd>lua require'dap'.step_out()<CR>
" Breakpoints
nnoremap <silent> <leader>dbb <cmd>lua require'dap'.toggle_breakpoint()<CR>
nnoremap <silent> <leader>dbc <cmd>lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition<cmd> '))<CR>
nnoremap <silent> <leader>dbl <cmd>lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message<cmd> '))<CR>
" Extra
nnoremap <silent> <leader>dp <cmd>lua require'dap'.run_last()<CR>
nnoremap <silent> <leader>dr <cmd>lua require'dap'.repl.open()<CR>
]]
-- vim.fn.sign_define('DapBreakpoint', {text='B', texthl='', linehl='', numhl=''}) -- custom attributes of breakpointed lines (use an emoji?)
vim.cmd "au FileType dap-repl lua require('dap.ext.autocompl').attach()"
-- per-language config:
local dap = require('dap')
-- c++ dap congiguration >>>
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}',
stopOnEntry = true,
},
}
dap.adapters.cppdbg = {
type = 'executable',
command = '/home/blake/.local/share/nvim/dapinstall/ccppr_vsc/extension/debugAdapters/bin/OpenDebugAD7',
}
-- <<<
end -- <<<
-- DAP installer >>>
M.dapinstall = function()
local dap_install = require("dap-install")
dap_install.setup({
installation_path = vim.fn.stdpath("data") .. "/dapinstall/",
})
end -- <<<
return M
-- vim:fdm=marker:fmr=>>>,<<<:expandtab:tabstop=3:sw=3