mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-01 12:16:33 +00:00
Improve dap configs and add go.nvim for Go dap
This commit is contained in:
parent
d586021831
commit
e6cdf2a0bf
@ -51,6 +51,10 @@
|
|||||||
"branch": "dev",
|
"branch": "dev",
|
||||||
"commit": "2f7c075f485ea9b9d834814028c691492d52445c"
|
"commit": "2f7c075f485ea9b9d834814028c691492d52445c"
|
||||||
},
|
},
|
||||||
|
"go.nvim": {
|
||||||
|
"branch": "master",
|
||||||
|
"commit": "12ab6ac0fdd03b1ec9ee4e5378dd204f744a55bf"
|
||||||
|
},
|
||||||
"goyo.vim": {
|
"goyo.vim": {
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"commit": "fa0263d456dd43f5926484d1c4c7022dfcb21ba9"
|
"commit": "fa0263d456dd43f5926484d1c4c7022dfcb21ba9"
|
||||||
|
@ -223,17 +223,58 @@ return {
|
|||||||
-- Debug adapter protocol
|
-- Debug adapter protocol
|
||||||
{
|
{
|
||||||
"https://github.com/mfussenegger/nvim-dap",
|
"https://github.com/mfussenegger/nvim-dap",
|
||||||
-- TODO: Load this only when the required debuggers are loaded
|
config = function()
|
||||||
ft = { "python", "rust" },
|
local dap = require("dap")
|
||||||
},
|
local dap_mapping = utils.curry_keymap("n", "<leader>d", {
|
||||||
|
group_desc = "Debugging",
|
||||||
|
silent = true,
|
||||||
|
noremap = true,
|
||||||
|
})
|
||||||
|
dap_mapping("d", dap.toggle_breakpoint, { desc = "Toggle breakpoint" })
|
||||||
|
dap_mapping("b", dap.toggle_breakpoint, { desc = "Toggle breakpoint" })
|
||||||
|
dap_mapping("p", dap.toggle_breakpoint, { desc = "Toggle breakpoint" })
|
||||||
|
|
||||||
|
dap_mapping("c", dap.continue, { desc = "Continue" })
|
||||||
|
dap_mapping("C", dap.run_to_cursor, { desc = "Run to cursor" })
|
||||||
|
dap_mapping("s", dap.stop, { desc = "Stop" })
|
||||||
|
dap_mapping("n", dap.step_over, { desc = "Step over" })
|
||||||
|
dap_mapping("i", dap.step_into, { desc = "Step into" })
|
||||||
|
dap_mapping("O", dap.step_out, { desc = "Step out" })
|
||||||
|
|
||||||
|
-- dap_mapping("h", dap.toggle_hover, { desc = "Toggle hover" })
|
||||||
|
dap_mapping("D", dap.disconnect, { desc = "Disconnect" })
|
||||||
|
-- dap_mapping("r", dap.repl.open, { desc = "Open REPL" })
|
||||||
|
-- dap_mapping("R", dap.repl.run_last, { desc = "Run last" })
|
||||||
|
|
||||||
|
-- Set dap signs
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"DapBreakpoint",
|
||||||
|
{ text = utils.debug_icons.breakpoint, texthl = "", linehl = "", numhl = "" }
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"DapLogPoint",
|
||||||
|
{ text = utils.debug_icons.log_point, texthl = "", linehl = "", numhl = "" }
|
||||||
|
)
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"DapBreakpointCondition",
|
||||||
|
{ text = utils.debug_icons.conditional_breakpoint, texthl = "", linehl = "", numhl = "" }
|
||||||
|
)
|
||||||
|
vim.fn.sign_define("DapStopped", { text = utils.debug_icons.current, texthl = "", linehl = "", numhl = "" })
|
||||||
|
vim.fn.sign_define(
|
||||||
|
"DapBreakpointRejected",
|
||||||
|
{ text = utils.debug_icons.breakpoint_rejected, texthl = "", linehl = "", numhl = "" }
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"https://github.com/rcarriga/nvim-dap-ui",
|
"https://github.com/rcarriga/nvim-dap-ui",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "https://github.com/mfussenegger/nvim-dap" },
|
{ "https://github.com/mfussenegger/nvim-dap" },
|
||||||
{ "nvim-neotest/nvim-nio" },
|
{ "nvim-neotest/nvim-nio" },
|
||||||
},
|
},
|
||||||
ft = { "python", "rust" },
|
ft = { "python", "rust", "go" },
|
||||||
config = function()
|
config = function()
|
||||||
require("dapui").setup({
|
require("dapui").setup({
|
||||||
icons = {
|
icons = {
|
||||||
@ -242,17 +283,7 @@ return {
|
|||||||
current_frame = ">",
|
current_frame = ">",
|
||||||
},
|
},
|
||||||
controls = {
|
controls = {
|
||||||
icons = {
|
icons = utils.debug_control_icons,
|
||||||
disconnect = "disconnect",
|
|
||||||
pause = "pause",
|
|
||||||
play = "play",
|
|
||||||
run_last = "last",
|
|
||||||
step_back = "back",
|
|
||||||
step_into = "into",
|
|
||||||
step_out = "out",
|
|
||||||
step_over = "over",
|
|
||||||
terminate = "term",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
local dap, dapui = require("dap"), require("dapui")
|
local dap, dapui = require("dap"), require("dapui")
|
||||||
@ -270,8 +301,16 @@ return {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"https://github.com/mfussenegger/nvim-dap-python",
|
"https://github.com/mfussenegger/nvim-dap-python",
|
||||||
dependencies = { { "https://github.com/mfussenegger/nvim-dap" } },
|
dependencies = {
|
||||||
config = true,
|
{ "https://github.com/rcarriga/nvim-dap-ui" },
|
||||||
|
{ "https://github.com/mfussenegger/nvim-dap" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- This is where pipx is installing debugpy via ./install-helpers.py
|
||||||
|
-- Could maybe detect by doing a which debugpy and then reading the interpreter
|
||||||
|
-- from the shebang line.
|
||||||
|
require("dap-python").setup("~/.local/pipx/venvs/debugpy/bin/python3")
|
||||||
|
end,
|
||||||
ft = { "python" },
|
ft = { "python" },
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -483,6 +522,39 @@ return {
|
|||||||
-- Filetypes
|
-- Filetypes
|
||||||
{ "https://github.com/ViViDboarder/vim-forcedotcom" },
|
{ "https://github.com/ViViDboarder/vim-forcedotcom" },
|
||||||
{ "https://github.com/hsanson/vim-android" },
|
{ "https://github.com/hsanson/vim-android" },
|
||||||
|
{
|
||||||
|
"https://github.com/ray-x/go.nvim",
|
||||||
|
dependencies = { -- optional packages
|
||||||
|
-- "https://github.com/ray-x/guihua.lua",
|
||||||
|
"https://github.com/neovim/nvim-lspconfig",
|
||||||
|
"https://github.com/nvim-treesitter/nvim-treesitter",
|
||||||
|
"https://github.com/rcarriga/nvim-dap-ui",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("go").setup({
|
||||||
|
icons = false,
|
||||||
|
-- I don't like the normal mode keymap because it overrides `w`
|
||||||
|
dap_debug_keymap = false,
|
||||||
|
-- Disable gui setup becuase this is set up with dap-ui
|
||||||
|
dap_debug_gui = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Override some keymaps because this plugin needs to start with debug run
|
||||||
|
local godap = require("go.dap")
|
||||||
|
utils.keymap_set("n", "<leader>dc", function()
|
||||||
|
if require("dap").session() == nil then
|
||||||
|
godap.run()
|
||||||
|
else
|
||||||
|
godap.continue()
|
||||||
|
end
|
||||||
|
end, { desc = "Continue" })
|
||||||
|
utils.keymap_set("n", "<leader>dR", godap.run, { desc = "Debug" })
|
||||||
|
utils.keymap_set("n", "<leader>ds", godap.stop, { desc = "Stop" })
|
||||||
|
end,
|
||||||
|
event = { "CmdlineEnter" },
|
||||||
|
ft = { "go", "gomod" },
|
||||||
|
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"https://github.com/sheerun/vim-polyglot",
|
"https://github.com/sheerun/vim-polyglot",
|
||||||
config = function()
|
config = function()
|
||||||
|
@ -201,4 +201,38 @@ if vim.env["TERM"] == "xterm-kitty" then
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.debug_icons = {
|
||||||
|
breakpoint = "🛑",
|
||||||
|
conditional_breakpoint = "🔍",
|
||||||
|
log_point = "📝",
|
||||||
|
current = "👉",
|
||||||
|
breakpoint_rejected = "🚫",
|
||||||
|
}
|
||||||
|
|
||||||
|
M.debug_control_icons = {
|
||||||
|
disconnect = "⏏️",
|
||||||
|
pause = "⏸️",
|
||||||
|
play = "▶️",
|
||||||
|
run_last = "⏮️",
|
||||||
|
step_back = "◀️",
|
||||||
|
step_into = "⤵️",
|
||||||
|
step_out = "⤴️",
|
||||||
|
step_over = "⏭️",
|
||||||
|
terminate = "⏹️",
|
||||||
|
}
|
||||||
|
|
||||||
|
if vim.env["TERM"] == "xterm-kitty" then
|
||||||
|
M.debug_control_icons = {
|
||||||
|
disconnect = "⏏",
|
||||||
|
pause = "⏸",
|
||||||
|
play = "▶",
|
||||||
|
run_last = "⏮",
|
||||||
|
step_back = "◀",
|
||||||
|
step_into = "⤵",
|
||||||
|
step_out = "⤴",
|
||||||
|
step_over = "⏭",
|
||||||
|
terminate = "⏹",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
Loading…
Reference in New Issue
Block a user