[wip] nvim: start migration to nvim-dap
This commit is contained in:
parent
e02802369d
commit
cc9a8d71f1
12
.gitmodules
vendored
12
.gitmodules
vendored
@ -99,3 +99,15 @@
|
||||
[submodule "src/.local/share/nvim/site/pack/3pp/start/colorbuddy.nvim"]
|
||||
path = src/.local/share/nvim/site/pack/3pp/start/colorbuddy.nvim
|
||||
url = https://github.com/tjdevries/colorbuddy.nvim.git
|
||||
[submodule "nvim-dap"]
|
||||
path = nvim-dap
|
||||
url = https://github.com/mfussenegger/nvim-dap.git
|
||||
[submodule "src/.local/share/nvim/site/pack/3pp/start/nvim-dap"]
|
||||
path = src/.local/share/nvim/site/pack/3pp/start/nvim-dap
|
||||
url = https://github.com/mfussenegger/nvim-dap.git
|
||||
[submodule "src/.local/share/nvim/site/pack/3pp/start/nvim-dap-ui"]
|
||||
path = src/.local/share/nvim/site/pack/3pp/start/nvim-dap-ui
|
||||
url = https://github.com/rcarriga/nvim-dap-ui.git
|
||||
[submodule "src/.local/share/nvim/site/pack/3pp/start/nvim-nio"]
|
||||
path = src/.local/share/nvim/site/pack/3pp/start/nvim-nio
|
||||
url = https://github.com/nvim-neotest/nvim-nio
|
||||
|
@ -7,7 +7,7 @@ set foldexpr=nvim_treesitter#foldexpr()
|
||||
" unfold by default
|
||||
set foldlevel=99
|
||||
|
||||
source $XDG_CONFIG_HOME/nvim/vimspector.vim
|
||||
" source $XDG_CONFIG_HOME/nvim/vimspector.vim
|
||||
|
||||
" auto-pairs
|
||||
let g:AutoPairsFlyMode = 0
|
||||
|
@ -1,7 +1,7 @@
|
||||
-- stuff for coding
|
||||
|
||||
confutil = require("confutil")
|
||||
keymap = confutil.keymap
|
||||
local confutil = require("confutil")
|
||||
local keymap = confutil.keymap
|
||||
|
||||
|
||||
------
|
||||
|
@ -10,7 +10,7 @@ function M.keymap(key, cmd, params)
|
||||
|
||||
default_params = {
|
||||
silent=true,
|
||||
mode="n",
|
||||
mode={'n'},
|
||||
noremap=true,
|
||||
}
|
||||
setmetatable(params, {
|
||||
@ -19,7 +19,7 @@ function M.keymap(key, cmd, params)
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_set_keymap(params.mode, key, cmd, { silent=params.silent, noremap=params.noremap })
|
||||
vim.keymap.set(params.mode, key, cmd, { silent=params.silent, noremap=params.noremap })
|
||||
end
|
||||
|
||||
-- see ~/.config/dot_profile.example for info
|
||||
|
138
src/.config/nvim/lua/debugging.lua
Normal file
138
src/.config/nvim/lua/debugging.lua
Normal file
@ -0,0 +1,138 @@
|
||||
-- dap and debugging related configurations
|
||||
|
||||
local confutil = require("confutil")
|
||||
local keymap = confutil.keymap
|
||||
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
|
||||
--------------------------------
|
||||
--------------------------------
|
||||
-- dap-ui configuration
|
||||
--------------------------------
|
||||
--------------------------------
|
||||
|
||||
----------------
|
||||
-- key bindings
|
||||
----------------
|
||||
|
||||
keymap("<leader>dd", dapui.setup)
|
||||
keymap("<leader>rs", dap.continue)
|
||||
keymap("<leader>rt", dap.restart)
|
||||
keymap("<leader>rr", dap.terminate)
|
||||
keymap("<c-p>", dap.step_into)
|
||||
keymap("<c-n>", dap.step_over)
|
||||
keymap("<F12>", dap.step_out)
|
||||
keymap("<leader>dsf", dap.toggle_breakpoint)
|
||||
keymap("<leader>dsc", dap.clear_breakpoints)
|
||||
keymap("<leader>dsF", function()
|
||||
dap.set_breakpoint(vim.fn.input("cond: "))
|
||||
end)
|
||||
keymap("K", dapui.eval, {mode = {'n', 'v'}})
|
||||
|
||||
----------------
|
||||
-- ui setup
|
||||
----------------
|
||||
|
||||
-- https://github.com/rcarriga/nvim-dap-ui/blob/master/doc/nvim-dap-ui.txt
|
||||
dapui.setup({
|
||||
controls = {
|
||||
enabled = false,
|
||||
},
|
||||
icons = {
|
||||
collapsed = ">",
|
||||
current_frame = ">",
|
||||
expanded = "v",
|
||||
},
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{
|
||||
id = "stacks",
|
||||
size = 0.20
|
||||
},
|
||||
{
|
||||
id = "scopes",
|
||||
size = 0.40
|
||||
},
|
||||
{
|
||||
id = "watches",
|
||||
size = 0.40
|
||||
},
|
||||
},
|
||||
position = "left",
|
||||
size = 40
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
{
|
||||
id = "repl",
|
||||
size = 1
|
||||
},
|
||||
},
|
||||
position = "bottom",
|
||||
size = 10
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
{
|
||||
id = "console",
|
||||
size = 1
|
||||
}
|
||||
},
|
||||
position = "right",
|
||||
size = 50
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
dap.listeners.after.launch.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.after.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.after.event_terminated.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.after.event_exited.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
|
||||
--------------------------------
|
||||
--------------------------------
|
||||
-- debug adapter configs
|
||||
--------------------------------
|
||||
--------------------------------
|
||||
|
||||
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#python
|
||||
dap.adapters.python = function(cb, config)
|
||||
if config.request == 'attach' then
|
||||
assert(false, "attach not implemented")
|
||||
else
|
||||
cb({
|
||||
type = 'executable',
|
||||
command = "python",
|
||||
args = { "-m", "debugpy.adapter" },
|
||||
options = {
|
||||
source_filetype = "python",
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
-- dap parts
|
||||
type = "python";
|
||||
request = "launch";
|
||||
name = "launch file";
|
||||
|
||||
-- debugger parts
|
||||
program = "${file}";
|
||||
-- this could be smarter (e.g., try to find a virtual env)
|
||||
pythonPath = function() return "/usr/bin/python" end;
|
||||
console = "integratedTerminal";
|
||||
}
|
||||
}
|
@ -101,4 +101,5 @@ end
|
||||
|
||||
if dotprofile >= profile_table.DEFAULT then
|
||||
require("coding")
|
||||
require("debugging")
|
||||
end
|
||||
|
@ -0,0 +1 @@
|
||||
Subproject commit 405df1dcc2e395ab5173a9c3d00e03942c023074
|
@ -0,0 +1 @@
|
||||
Subproject commit edfa93f60b189e5952c016eee262d0685d838450
|
@ -0,0 +1 @@
|
||||
Subproject commit 33c62b3eadd8154169e42144de16ba4db6784bec
|
Loading…
Reference in New Issue
Block a user