update debug key

This commit is contained in:
asep komarudin 2023-01-30 23:56:23 +07:00
parent 95eaff2a7d
commit a794147d8f

View file

@ -91,7 +91,30 @@ local trn = ""
if vim.fn.has("win32") then if vim.fn.has("win32") then
trn = "pwsh<cr>" trn = "pwsh<cr>"
end end
-- for debug
local debug_key = {}
local is_dap = pcall(require, "dap") local is_dap = pcall(require, "dap")
if is_dap then
debug_key = {
name = "Debug",
t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
b = { "<cmd>lua require'dap'.step_back()<cr>", "Step Back" },
c = { "<cmd>lua require'dap'.continue()<cr>", "Continue" },
C = { "<cmd>lua require'dap'.run_to_cursor()<cr>", "Run To Cursor" },
d = { "<cmd>lua require'dap'.disconnect()<cr>", "Disconnect" },
g = { "<cmd>lua require'dap'.session()<cr>", "Get Session" },
i = { "<cmd>lua require'dap'.step_into()<cr>", "Step Into" },
o = { "<cmd>lua require'dap'.step_over()<cr>", "Step Over" },
u = { "<cmd>lua require'dap'.step_out()<cr>", "Step Out" },
p = { "<cmd>lua require'dap'.pause()<cr>", "Pause" },
r = { "<cmd>lua require'dap'.repl.toggle()<cr>", "Toggle Repl" },
s = { "<cmd>lua require'dap'.continue()<cr>", "Start" },
q = { "<cmd>lua require'dap'.close()<cr>", "Quit" },
U = { "<cmd>lua require'dapui'.toggle({reset = true})<cr>", "Toggle UI" },
}
end
-- end debug
local mappings2 = { local mappings2 = {
["/"] = { "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", "Commet Block" }, ["/"] = { "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", "Commet Block" },
} }
@ -113,7 +136,7 @@ local mappings = {
}, },
["F"] = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" }, ["F"] = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" },
["P"] = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" }, ["P"] = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" },
["z"] = { "<cmd>Lazy<cr>", "Lazy" }, -- ["z"] = { "<cmd>Lazy<cr>", "Lazy" },
["/"] = { ["/"] = {
function() function()
@ -227,118 +250,147 @@ local mappings = {
"Run MVN", "Run MVN",
}, },
}, },
D = { -- D = {
name = "Debug", -- name = "Debug",
b = { -- b = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").toggle_breakpoint() -- require("dap").toggle_breakpoint()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Toggle Breakpoint", -- "Toggle Breakpoint",
}, -- },
B = { -- B = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").clear_breakpoints() -- require("dap").clear_breakpoints()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Clear Breakpoints", -- "Clear Breakpoints",
}, -- },
c = { -- c = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").continue() -- require("dap").continue()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Start/Continue", -- "Start/Continue",
}, -- },
i = { -- i = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").step_into() -- require("dap").step_into()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Step Into (F11)", -- "Step Into (F11)",
}, -- },
o = { -- o = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").step_over() -- require("dap").step_over()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Step Over (F10)", -- "Step Over (F10)",
}, -- },
O = { -- O = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").step_out() -- require("dap").step_out()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Step Out (S-F11)", -- "Step Out (S-F11)",
}, -- },
q = { -- q = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").close() -- require("dap").close()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Close Session", -- "Close Session",
}, -- },
Q = { -- Q = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").terminate() -- require("dap").terminate()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Terminate Session (S-F5)", -- "Terminate Session (S-F5)",
}, -- },
p = { -- p = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").pause() -- require("dap").pause()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Pause (F6)", -- "Pause (F6)",
}, -- },
r = { -- r = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").restart_frame() -- require("dap").restart_frame()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Restart (C-F5)", -- "Restart (C-F5)",
}, -- },
R = { -- R = {
function() -- function()
if is_dap then -- if is_dap then
require("dap").repl.toggle() -- require("dap").repl.toggle()
else -- else
vim.notify("DAP Not Support", "info") -- vim.notify("DAP Not Support", "info")
end -- end
end, -- end,
"Toggle REPL", -- "Toggle REPL",
}, -- },
-- },
-- d = {
-- name = "Debug",
-- t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
-- b = { "<cmd>lua require'dap'.step_back()<cr>", "Step Back" },
-- c = { "<cmd>lua require'dap'.continue()<cr>", "Continue" },
-- C = { "<cmd>lua require'dap'.run_to_cursor()<cr>", "Run To Cursor" },
-- d = { "<cmd>lua require'dap'.disconnect()<cr>", "Disconnect" },
-- g = { "<cmd>lua require'dap'.session()<cr>", "Get Session" },
-- i = { "<cmd>lua require'dap'.step_into()<cr>", "Step Into" },
-- o = { "<cmd>lua require'dap'.step_over()<cr>", "Step Over" },
-- u = { "<cmd>lua require'dap'.step_out()<cr>", "Step Out" },
-- p = { "<cmd>lua require'dap'.pause()<cr>", "Pause" },
-- r = { "<cmd>lua require'dap'.repl.toggle()<cr>", "Toggle Repl" },
-- s = { "<cmd>lua require'dap'.continue()<cr>", "Start" },
-- q = { "<cmd>lua require'dap'.close()<cr>", "Quit" },
-- U = { "<cmd>lua require'dapui'.toggle({reset = true})<cr>", "Toggle UI" },
-- },
d = debug_key,
p = {
name = "Plugins",
i = { "<cmd>Lazy install<cr>", "Install" },
s = { "<cmd>Lazy sync<cr>", "Sync" },
S = { "<cmd>Lazy clear<cr>", "Status" },
c = { "<cmd>Lazy clean<cr>", "Clean" },
u = { "<cmd>Lazy update<cr>", "Update" },
p = { "<cmd>Lazy profile<cr>", "Profile" },
l = { "<cmd>Lazy log<cr>", "Log" },
d = { "<cmd>Lazy debug<cr>", "Debug" },
}, },
} }