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