Add overseer and dap
This commit is contained in:
parent
167534d65f
commit
0709c23757
27
.config/nvim/lua/overseer/template/user/cmake_build.lua
Normal file
27
.config/nvim/lua/overseer/template/user/cmake_build.lua
Normal file
@ -0,0 +1,27 @@
|
||||
return {
|
||||
name = "CMake Build",
|
||||
builder = function()
|
||||
local file = vim.fn.expand("%:p")
|
||||
return {
|
||||
cmd = {
|
||||
"cmake"
|
||||
},
|
||||
args = {
|
||||
"--build",
|
||||
"build"
|
||||
},
|
||||
components = {
|
||||
{
|
||||
"on_output_quickfix"
|
||||
},
|
||||
"default"
|
||||
}
|
||||
}
|
||||
end,
|
||||
condition = {
|
||||
filetype = {
|
||||
"cmake",
|
||||
"cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
24
.config/nvim/lua/overseer/template/user/cmake_clean.lua
Normal file
24
.config/nvim/lua/overseer/template/user/cmake_clean.lua
Normal file
@ -0,0 +1,24 @@
|
||||
return {
|
||||
name = "CMake Clean",
|
||||
builder = function()
|
||||
local file = vim.fn.expand("%:p")
|
||||
return {
|
||||
cmd = {
|
||||
"rm"
|
||||
},
|
||||
args = {
|
||||
"-r",
|
||||
"build",
|
||||
},
|
||||
components = {
|
||||
"default"
|
||||
}
|
||||
}
|
||||
end,
|
||||
condition = {
|
||||
filetype = {
|
||||
"cmake",
|
||||
"cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
58
.config/nvim/lua/overseer/template/user/cmake_generate.lua
Normal file
58
.config/nvim/lua/overseer/template/user/cmake_generate.lua
Normal file
@ -0,0 +1,58 @@
|
||||
return {
|
||||
name = "CMake Generate",
|
||||
params = {
|
||||
build_type = {
|
||||
type = "enum",
|
||||
choices = {
|
||||
"Debug",
|
||||
"Release",
|
||||
"RelWithDebInfo",
|
||||
"MinSizeRel"
|
||||
},
|
||||
default = "Debug"
|
||||
},
|
||||
generator = {
|
||||
type = "enum",
|
||||
choices = {
|
||||
"Ninja",
|
||||
"Unix Makefiles"
|
||||
},
|
||||
default = "Ninja"
|
||||
},
|
||||
compiler = {
|
||||
type = "enum",
|
||||
choices = {
|
||||
"g++",
|
||||
"clang++"
|
||||
},
|
||||
default = "g++"
|
||||
}
|
||||
},
|
||||
builder = function(params)
|
||||
return {
|
||||
cmd = {
|
||||
"cmake"
|
||||
},
|
||||
args = {
|
||||
"-B",
|
||||
"build",
|
||||
"-S",
|
||||
".",
|
||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
|
||||
"-DCMAKE_BUILD_TYPE=" .. params.build_type,
|
||||
"-DCMAKE_CXX_COMPILER=" .. params.compiler,
|
||||
"-G",
|
||||
params.generator
|
||||
},
|
||||
components = {
|
||||
"default"
|
||||
}
|
||||
}
|
||||
end,
|
||||
condition = {
|
||||
filetype = {
|
||||
"cmake",
|
||||
"cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
27
.config/nvim/lua/overseer/template/user/cmake_test.lua
Normal file
27
.config/nvim/lua/overseer/template/user/cmake_test.lua
Normal file
@ -0,0 +1,27 @@
|
||||
return {
|
||||
name = "CMake Test",
|
||||
builder = function()
|
||||
return {
|
||||
cmd = {
|
||||
"ctest"
|
||||
},
|
||||
args = {
|
||||
"--test-dir",
|
||||
"build",
|
||||
"--output-on-failure",
|
||||
},
|
||||
components = {
|
||||
{
|
||||
"on_output_quickfix"
|
||||
},
|
||||
"default"
|
||||
}
|
||||
}
|
||||
end,
|
||||
condition = {
|
||||
filetype = {
|
||||
"cmake",
|
||||
"cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
22
.config/nvim/lua/overseer/template/user/python_run.lua
Normal file
22
.config/nvim/lua/overseer/template/user/python_run.lua
Normal file
@ -0,0 +1,22 @@
|
||||
return {
|
||||
name = "Python Run",
|
||||
builder = function()
|
||||
local file = vim.fn.expand("%:p")
|
||||
return {
|
||||
cmd = {
|
||||
"python"
|
||||
},
|
||||
args = {
|
||||
file
|
||||
},
|
||||
components = {
|
||||
"default"
|
||||
}
|
||||
}
|
||||
end,
|
||||
condition = {
|
||||
filetype = {
|
||||
"python"
|
||||
}
|
||||
}
|
||||
}
|
||||
154
.config/nvim/lua/plugins/dap.lua
Normal file
154
.config/nvim/lua/plugins/dap.lua
Normal file
@ -0,0 +1,154 @@
|
||||
return {
|
||||
{
|
||||
'mfussenegger/nvim-dap',
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
dap.adapters.gdb = {
|
||||
type = "executable",
|
||||
command = "gdb",
|
||||
args = {
|
||||
"-i",
|
||||
"dap"
|
||||
}
|
||||
}
|
||||
dap.adapters.python = function(cb, config)
|
||||
if config.request == 'attach' then
|
||||
local port = (config.connect or config).port
|
||||
local host = (config.connect or config).host or '127.0.0.1'
|
||||
cb({
|
||||
type = 'server',
|
||||
port = assert(port, '`connect.port` is required for a python `attach` configuration'),
|
||||
host = host,
|
||||
options = {
|
||||
source_filetype = 'python'
|
||||
}
|
||||
})
|
||||
else
|
||||
cb({
|
||||
type = 'executable',
|
||||
command = 'python',
|
||||
args = {
|
||||
'-m',
|
||||
'debugpy.adapter'
|
||||
},
|
||||
options = {
|
||||
source_filetype = 'python'
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "gdb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopAtBeginningOfMainSubprogram = false
|
||||
}
|
||||
}
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "gdb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopAtBeginningOfMainSubprogram = false
|
||||
}
|
||||
}
|
||||
dap.configurations.python = {
|
||||
{
|
||||
type = 'python',
|
||||
request = 'launch',
|
||||
name = "Launch file",
|
||||
|
||||
program = "${file}",
|
||||
pythonPath = function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
|
||||
return cwd .. '/venv/bin/python'
|
||||
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
|
||||
return cwd .. '/.venv/bin/python'
|
||||
else
|
||||
return '/usr/bin/python'
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<leader>db", "<cmd>DapToggleBreakpoint<cr>", {
|
||||
desc = "Toggle breakpoint"
|
||||
})
|
||||
vim.keymap.set("n", "<leader>dc", "<cmd>DapContinue<cr>", {
|
||||
desc = "Continue"
|
||||
})
|
||||
vim.keymap.set("n", "<leader>dt", "<cmd>DapTerminate<cr>", {
|
||||
desc = "Terminate"
|
||||
})
|
||||
vim.keymap.set("n", "<leader>di", "<cmd>DapStepInto<cr>", {
|
||||
desc = "Step into"
|
||||
})
|
||||
vim.keymap.set("n", "<leader>dn", "<cmd>DapStepOver<cr>", {
|
||||
desc = "Step over"
|
||||
})
|
||||
vim.keymap.set("n", "<leader>do", "<cmd>DapStepOut<cr>", {
|
||||
desc = "Step out"
|
||||
})
|
||||
vim.keymap.set("n", '<Leader>dh', function() require('dap.ui.widgets').hover() end, {
|
||||
desc = "Hover"
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"nvim-neotest/nvim-nio"
|
||||
},
|
||||
config = function()
|
||||
require("dapui").setup({
|
||||
controls = {
|
||||
enabled = false
|
||||
},
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{
|
||||
id = "scopes",
|
||||
size = 0.33
|
||||
},
|
||||
{
|
||||
id = "breakpoints",
|
||||
size = 0.33
|
||||
},
|
||||
{
|
||||
id = "stacks",
|
||||
size = 0.33
|
||||
}
|
||||
},
|
||||
position = "left",
|
||||
size = 60
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
{
|
||||
id = "repl",
|
||||
size = 1
|
||||
}
|
||||
},
|
||||
position = "bottom",
|
||||
size = 15
|
||||
}
|
||||
}
|
||||
})
|
||||
vim.keymap.set("n", "<leader>du", function() require("dapui").toggle() end, {
|
||||
desc = " Toggle UI"
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
28
.config/nvim/lua/plugins/overseer.lua
Normal file
28
.config/nvim/lua/plugins/overseer.lua
Normal file
@ -0,0 +1,28 @@
|
||||
return {
|
||||
"stevearc/overseer.nvim",
|
||||
config = function()
|
||||
require("overseer").setup({
|
||||
templates = {
|
||||
"builtin",
|
||||
"user.cmake_generate",
|
||||
"user.cmake_build",
|
||||
"user.cmake_clean",
|
||||
"user.cmake_test",
|
||||
"user.python_run"
|
||||
}
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>oo", function() require("overseer").toggle() end, {
|
||||
desc = "Toggle"
|
||||
})
|
||||
vim.keymap.set("n", "<leader>or", ":OverseerRun<CR>", {
|
||||
desc = "Run"
|
||||
})
|
||||
vim.keymap.set("n", "<leader>oq", ":OverseerQuickAction<CR>", {
|
||||
desc = "Quick Action"
|
||||
})
|
||||
vim.keymap.set("n", "<leader>of", ":OverseerQuickAction open float<CR>", {
|
||||
desc = "Open Float"
|
||||
})
|
||||
end
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user