Initial DAP support
This commit is contained in:
parent
f0af0f67b8
commit
a8165e94c2
2 changed files with 69 additions and 20 deletions
|
@ -1,14 +1,15 @@
|
|||
local M = {}
|
||||
|
||||
M.signature = function() ---- lsp_signature >>>
|
||||
-- lsp_signature >>>
|
||||
M.signature = function()
|
||||
require "lsp_signature".setup()
|
||||
cfg = {
|
||||
Gse_lspsaga = true
|
||||
}
|
||||
end
|
||||
-- <<<
|
||||
end -- <<<
|
||||
|
||||
M.lspinstall = function() ---- lspinstall >>>
|
||||
-- lspinstall >>>
|
||||
M.lspinstall = function() --
|
||||
local function setup_servers()
|
||||
require'lspinstall'.setup()
|
||||
local servers = require'lspinstall'.installed_servers()
|
||||
|
@ -24,10 +25,10 @@ M.lspinstall = function() ---- lspinstall >>>
|
|||
setup_servers() -- reload installed servers
|
||||
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
|
||||
end
|
||||
end
|
||||
-- <<<
|
||||
end -- <<<
|
||||
|
||||
M.treesitter = function() ---- treesitter >>>
|
||||
-- treesitter >>>
|
||||
M.treesitter = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
|
@ -95,10 +96,10 @@ M.treesitter = function() ---- treesitter >>>
|
|||
-- enable = true
|
||||
-- }
|
||||
-- }
|
||||
end
|
||||
-- <<<
|
||||
end -- <<<
|
||||
|
||||
M.cmp = function() ---- cmp >>>
|
||||
-- cmp >>>
|
||||
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)
|
||||
|
@ -175,10 +176,10 @@ M.cmp = function() ---- cmp >>>
|
|||
end,
|
||||
},
|
||||
}
|
||||
end
|
||||
-- <<<
|
||||
end -- <<<
|
||||
|
||||
M.lspconfig = function() ---- lspconfig >>>
|
||||
-- lspconfig >>>
|
||||
M.lspconfig = function()
|
||||
local nvim_lsp = require('lspconfig')
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
|
@ -225,8 +226,45 @@ M.lspconfig = function() ---- lspconfig >>>
|
|||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
-- <<<
|
||||
end -- <<<
|
||||
|
||||
-- DAP: Debug Adapter Protocol >>>
|
||||
M.dap = function()
|
||||
-- default keybinds
|
||||
vim.cmd [[
|
||||
nnoremap <silent> <leader><F5> <cmd>lua require'dap'.continue()<CR>
|
||||
nnoremap <silent> <leader><F6> <cmd>lua require'dap'.step_over()<CR>
|
||||
nnoremap <silent> <leader><F7> <cmd>lua require'dap'.step_into()<CR>
|
||||
nnoremap <silent> <leader><F8> <cmd>lua require'dap'.step_out()<CR>
|
||||
nnoremap <silent> <leader>b <cmd>lua require'dap'.toggle_breakpoint()<CR>
|
||||
nnoremap <silent> <leader>B <cmd>lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition<cmd> '))<CR>
|
||||
nnoremap <silent> <leader>lp <cmd>lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message<cmd> '))<CR>
|
||||
nnoremap <silent> <leader>dl <cmd>lua require'dap'.run_last()<CR>
|
||||
nnoremap <silent> <leader>dr <cmd>lua require'dap'.repl.open()<CR>
|
||||
]]
|
||||
local dap = require('dap')
|
||||
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,
|
||||
},
|
||||
}
|
||||
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
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ end
|
|||
|
||||
return require('packer').startup(function()
|
||||
-- Packer
|
||||
use { -- plugins
|
||||
use { -- packer
|
||||
'wbthomason/packer.nvim'
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,18 @@ return require('packer').startup(function()
|
|||
-- end, 0)
|
||||
-- end,
|
||||
}
|
||||
use { -- DAP: Debug Adapter Protocol >>>
|
||||
"mfussenegger/nvim-dap",
|
||||
config = function()
|
||||
require("lsp").dap()
|
||||
end
|
||||
}
|
||||
use {
|
||||
"Pocco81/DAPInstall.nvim",
|
||||
config = function()
|
||||
require("lsp").dapinstall()
|
||||
end
|
||||
}
|
||||
use { -- Default LSP configs
|
||||
"neovim/nvim-lspconfig",
|
||||
after = "nvim-lspinstall",
|
||||
|
@ -107,9 +119,9 @@ return require('packer').startup(function()
|
|||
requires = {
|
||||
'nvim-lua/plenary.nvim'
|
||||
},
|
||||
-- config = function()
|
||||
-- require('other').gitsigns()
|
||||
-- end
|
||||
config = function()
|
||||
require('other').gitsigns()
|
||||
end,
|
||||
}
|
||||
use { -- file manager
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
|
@ -168,7 +180,6 @@ return require('packer').startup(function()
|
|||
use { -- tpope: Repeatability for various tpope plugins
|
||||
'tpope/vim-repeat',
|
||||
}
|
||||
|
||||
end)
|
||||
|
||||
-- vim:fdm=marker:fmr={,}:expandtab:tabstop=3:sw=3
|
||||
|
|
Loading…
Add table
Reference in a new issue