Compare commits
5 Commits
c1c36ee21c
...
9c82edec56
Author | SHA1 | Date | |
---|---|---|---|
9c82edec56 | |||
0d804702fb | |||
01a50f332d | |||
c3669df95a | |||
3c3bb83ff7 |
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -40,12 +40,6 @@
|
|||||||
path = src/.local/share/nvim/site/pack/3pp/start/auto-pairs
|
path = src/.local/share/nvim/site/pack/3pp/start/auto-pairs
|
||||||
url = https://github.com/jiangmiao/auto-pairs
|
url = https://github.com/jiangmiao/auto-pairs
|
||||||
|
|
||||||
# debugging and stuff
|
|
||||||
# vimspector.vim
|
|
||||||
[submodule "src/.local/share/nvim/site/pack/3pp/start/vimspector"]
|
|
||||||
path = src/.local/share/nvim/site/pack/3pp/start/vimspector
|
|
||||||
url = https://github.com/puremourning/vimspector.git
|
|
||||||
|
|
||||||
# language smarts
|
# language smarts
|
||||||
# coding.lua
|
# coding.lua
|
||||||
[submodule "src/.local/share/nvim/site/pack/3pp/start/nvim-lspconfig"]
|
[submodule "src/.local/share/nvim/site/pack/3pp/start/nvim-lspconfig"]
|
||||||
|
4
programs
4
programs
@ -131,10 +131,12 @@ python-black
|
|||||||
bash-language-server
|
bash-language-server
|
||||||
vscode-css-languageserver
|
vscode-css-languageserver
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
|
gdb
|
||||||
|
lldb
|
||||||
|
python-debugpy
|
||||||
arc-gtk-theme
|
arc-gtk-theme
|
||||||
lxappearance-gtk3
|
lxappearance-gtk3
|
||||||
radare2
|
radare2
|
||||||
gdb
|
|
||||||
typst
|
typst
|
||||||
|
|
||||||
# .local/bin/pyinstantref script
|
# .local/bin/pyinstantref script
|
||||||
|
5
src/.clang-format
Normal file
5
src/.clang-format
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
UseTab: Always
|
||||||
|
IndentWidth: 4
|
||||||
|
TabWidth: 4
|
@ -6,6 +6,8 @@ local keymap = confutil.keymap
|
|||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
local dapui = require("dapui")
|
local dapui = require("dapui")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- dap-ui configuration
|
-- dap-ui configuration
|
||||||
@ -16,9 +18,13 @@ local dapui = require("dapui")
|
|||||||
-- key bindings
|
-- key bindings
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
keymap("<leader>dd", dapui.setup)
|
|
||||||
keymap("<leader>rs", dap.continue)
|
keymap("<leader>rs", dap.continue)
|
||||||
keymap("<leader>rt", dap.restart)
|
keymap("<leader>rt", function()
|
||||||
|
-- hard restart (lldb just stops when restarted)
|
||||||
|
dap.terminate()
|
||||||
|
vim.cmd.sleep("100m")
|
||||||
|
dap.continue()
|
||||||
|
end)
|
||||||
keymap("<leader>rr", dap.terminate)
|
keymap("<leader>rr", dap.terminate)
|
||||||
keymap("<c-p>", dap.step_into)
|
keymap("<c-p>", dap.step_into)
|
||||||
keymap("<c-n>", dap.step_over)
|
keymap("<c-n>", dap.step_over)
|
||||||
@ -40,9 +46,9 @@ dapui.setup({
|
|||||||
enabled = false,
|
enabled = false,
|
||||||
},
|
},
|
||||||
icons = {
|
icons = {
|
||||||
collapsed = ">",
|
current_frame = "→",
|
||||||
current_frame = ">",
|
collapsed = "►",
|
||||||
expanded = "v",
|
expanded = "▼",
|
||||||
},
|
},
|
||||||
layouts = {
|
layouts = {
|
||||||
{
|
{
|
||||||
@ -90,10 +96,10 @@ end
|
|||||||
dap.listeners.after.attach.dapui_config = function()
|
dap.listeners.after.attach.dapui_config = function()
|
||||||
dapui.open()
|
dapui.open()
|
||||||
end
|
end
|
||||||
dap.listeners.after.event_terminated.dapui_config = function()
|
dap.listeners.before.event_terminated.dapui_config = function()
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
dap.listeners.after.event_exited.dapui_config = function()
|
dap.listeners.before.event_exited.dapui_config = function()
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -110,7 +116,60 @@ vim.cmd [[ sign define DapBreakpointCondition text=◒ ]]
|
|||||||
--------------------------------
|
--------------------------------
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
|
----------------
|
||||||
|
-- debug directory utilities
|
||||||
|
----------------
|
||||||
|
|
||||||
|
local function gf(file)
|
||||||
|
return file or vim.fn.expand("%:p")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.dbg_dir(file)
|
||||||
|
-- get a directory to store files needed for debugging
|
||||||
|
-- like ad hoc test cases, or compiled binaries
|
||||||
|
local dir = assert(vim.env.XDG_CACHE_HOME, "$XDG_CACHE_HOME is unset") .. "/nvimdbg"
|
||||||
|
local file = gf(file)
|
||||||
|
local subdir = dir .. file
|
||||||
|
assert(vim.fn.mkdir(subdir, "p"), "Could not create debug directory.")
|
||||||
|
return subdir
|
||||||
|
end
|
||||||
|
|
||||||
|
function compile(file)
|
||||||
|
local file = gf(file)
|
||||||
|
local subdir = M.dbg_dir(file)
|
||||||
|
vim.fn.execute("make " .. subdir .. "/binary " .. "-f $XDG_CONFIG_HOME/nvim/makefile")
|
||||||
|
end
|
||||||
|
keymap("<leader>dc", compile)
|
||||||
|
|
||||||
|
function write_input(file)
|
||||||
|
-- store ad hoc test input from clipboard
|
||||||
|
local file = gf(file)
|
||||||
|
local inp_file = M.dbg_dir(file) .. "/input"
|
||||||
|
vim.fn.writefile(vim.fn.getreg("+", 1, 1), inp_file)
|
||||||
|
end
|
||||||
|
function run_input(file)
|
||||||
|
local file = gf(file)
|
||||||
|
if not dapui.elements.console then
|
||||||
|
print("Unable to feed input: no console found")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vim.api.nvim_buf_call(dapui.elements.console.buffer(), function()
|
||||||
|
vim.b.nvimdbg_inp_file = M.dbg_dir(file) .. "/input"
|
||||||
|
vim.cmd [[
|
||||||
|
let @x = join(readfile(b:nvimdbg_inp_file), "\n") .. "\n\n"
|
||||||
|
normal G"xp
|
||||||
|
]]
|
||||||
|
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
keymap("<leader>rw", write_input)
|
||||||
|
keymap("<leader>ri", run_input)
|
||||||
|
|
||||||
|
|
||||||
|
----------------
|
||||||
|
-- python
|
||||||
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#python
|
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#python
|
||||||
|
----------------
|
||||||
dap.adapters.python = function(cb, config)
|
dap.adapters.python = function(cb, config)
|
||||||
if config.request == 'attach' then
|
if config.request == 'attach' then
|
||||||
assert(false, "attach not implemented")
|
assert(false, "attach not implemented")
|
||||||
@ -140,3 +199,34 @@ dap.configurations.python = {
|
|||||||
console = "integratedTerminal";
|
console = "integratedTerminal";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
----------------
|
||||||
|
-- c++
|
||||||
|
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#ccrust-via-gdb
|
||||||
|
----------------
|
||||||
|
dap.adapters.lldb = {
|
||||||
|
type = "executable",
|
||||||
|
command = "/usr/bin/lldb-vscode",
|
||||||
|
name = "lldb"
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.cpp = {
|
||||||
|
{
|
||||||
|
name = "launch binary",
|
||||||
|
type = "lldb",
|
||||||
|
request = "launch",
|
||||||
|
program = function()
|
||||||
|
local binary = M.dbg_dir() .. "/binary"
|
||||||
|
if not vim.fn.filereadable(binary) then
|
||||||
|
binary = vim.fn.input("binary: ", vim.fn.getcwd() .. "/", "file")
|
||||||
|
end
|
||||||
|
|
||||||
|
return binary
|
||||||
|
end,
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
stopOnEntry = false,
|
||||||
|
runInTerminal = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return M
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# makefile for compiling individual files from vim
|
# makefile for compiling individual files from vim
|
||||||
|
|
||||||
~/.cache/termdebug/bin/%: %.cpp
|
DBG_DIR=$(XDG_CACHE_HOME)/nvimdbg
|
||||||
@mkdir -p $(@D)
|
|
||||||
|
$(DBG_DIR)%.cpp/binary: %.cpp
|
||||||
$(LINK.cpp) -g -Wall -Wpedantic -std=c++20 $^ $(LOADLIBES) $(LDLIBS) -o $@
|
$(LINK.cpp) -g -Wall -Wpedantic -std=c++20 $^ $(LOADLIBES) $(LDLIBS) -o $@
|
||||||
|
|
||||||
~/.cache/termdebug/bin/%: %.c
|
$(DBG_DIR)%.c/binary: %.c
|
||||||
@mkdir -p $(@D)
|
|
||||||
$(LINK.c) -g -Wall -Wpedantic $^ $(LOADLIBES) $(LDLIBS) -o $@
|
$(LINK.c) -g -Wall -Wpedantic $^ $(LOADLIBES) $(LDLIBS) -o $@
|
||||||
|
Loading…
Reference in New Issue
Block a user