110 lines
6.6 KiB
Lua
110 lines
6.6 KiB
Lua
-- Clues =======================================================================
|
|
Config.leader_group_clues = {
|
|
{ mode = "n", keys = "<Leader>a", desc = "+AI" },
|
|
{ mode = "n", keys = "<Leader>b", desc = "+Buffer" },
|
|
{ mode = "n", keys = "<Leader>d", desc = "+Debug" },
|
|
{ mode = "n", keys = "<Leader>e", desc = "+Explore" },
|
|
{ mode = "n", keys = "<Leader>f", desc = "+Find" },
|
|
{ mode = "n", keys = "<Leader>g", desc = "+Git" },
|
|
{ mode = "n", keys = "<Leader>h", desc = "+Http" },
|
|
{ mode = "n", keys = "<Leader>l", desc = "+Language" },
|
|
{ mode = "n", keys = "<Leader>r", desc = "+Run" },
|
|
{ mode = "n", keys = "<Leader>s", desc = "+Session" },
|
|
{ mode = "n", keys = "<Leader>t", desc = "+Terminal" },
|
|
{ mode = "x", keys = "<Leader>g", desc = "+Git" },
|
|
{ mode = "x", keys = "<Leader>l", desc = "+Language" },
|
|
}
|
|
|
|
-- Helpers =====================================================================
|
|
local nmap = function(lhs, rhs, desc) vim.keymap.set("n", lhs, rhs, { desc = desc }) end
|
|
local nmap_leader = function(suffix, rhs, desc) vim.keymap.set("n", "<Leader>" .. suffix, rhs, { desc = desc }) end
|
|
local xmap_leader = function(suffix, rhs, desc) vim.keymap.set("x", "<Leader>" .. suffix, rhs, { desc = desc }) end
|
|
|
|
local function lazy_setup(name, action)
|
|
return function()
|
|
if Config and type(Config["setup_" .. name]) == "function" then
|
|
Config["setup_" .. name]()
|
|
end
|
|
action()
|
|
end
|
|
end
|
|
|
|
-- AI =====================================================================
|
|
nmap_leader("aa", lazy_setup("codecompanion", function() require("codecompanion").toggle_chat() end),
|
|
"Open CodeCompanion")
|
|
|
|
-- Buffers =====================================================================
|
|
nmap_leader("bd", function() vim.cmd("bd") end, "Delete")
|
|
nmap_leader("bD", function() vim.cmd("bd!") end, "Delete!")
|
|
nmap_leader("bw", function() vim.cmd("bw") end, "Wipeout")
|
|
nmap_leader("bW", function() vim.cmd("bw!") end, "Wipeout!")
|
|
nmap_leader("bo", function() vim.cmd("%bd|e#") end, "Close all but current")
|
|
|
|
-- Debug =====================================================================
|
|
nmap_leader("db", lazy_setup("dap", function() require("dap").toggle_breakpoint() end), "Toggle Breakpoint")
|
|
nmap_leader("dc", lazy_setup("dap", function() require("dap").continue() end), "Run/Continue")
|
|
nmap_leader("dC", lazy_setup("dap", function() require("dap").run_to_cursor() end), "Run to Cursor")
|
|
nmap_leader("de", lazy_setup("dap", function() require("dap.ui.widgets").hover() end), "Inspect")
|
|
nmap_leader("dt", lazy_setup("dap", function() require("dap").terminate() end), "Terminate")
|
|
|
|
-- Explore =====================================================================
|
|
nmap_leader("ed", function() MiniFiles.open() end, "Directory")
|
|
nmap_leader("ef", function() MiniFiles.open(vim.api.nvim_buf_get_name(0)) end, "File directory")
|
|
nmap_leader("en", function() MiniNotify.show_history() end, "Notifications")
|
|
|
|
-- Find =====================================================================
|
|
nmap_leader("f/", function() MiniPick.builtin.history({ scope = "/" }) end, '"/" history')
|
|
nmap_leader("f:", function() MiniPick.builtin.history({ scope = ":" }) end, '":" history')
|
|
nmap_leader("fb", function() MiniPick.builtin.buffers() end, "Buffers")
|
|
nmap_leader("fc", function() MiniPick.builtin.git_commits() end, "Commits (all)")
|
|
nmap_leader("fC", function() MiniPick.builtin.git_commits({ path = "%" }) end, "Commits (buf)")
|
|
nmap_leader("fd", function() MiniPick.builtin.diagnostic({ scope = "all" }) end, "Diagnostic workspace")
|
|
nmap_leader("fD", function() MiniPick.builtin.diagnostic({ scope = "current" }) end, "Diagnostic buffer")
|
|
nmap_leader("ff", function() MiniPick.builtin.files() end, "Files")
|
|
nmap_leader("fg", function() MiniPick.builtin.grep_live() end, "Grep live")
|
|
nmap_leader("fG", function() MiniPick.builtin.grep({ pattern = vim.fn.expand("<cword>") }) end, "Grep current word")
|
|
nmap_leader("fh", function() MiniPick.builtin.help() end, "Help tags")
|
|
nmap_leader("fl", function() MiniPick.builtin.buf_lines({ scope = "all" }) end, "Lines (all)")
|
|
nmap_leader("fL", function() MiniPick.builtin.buf_lines({ scope = "current" }) end, "Lines (buf)")
|
|
nmap_leader("fr", function() MiniPick.builtin.resume() end, "Resume")
|
|
nmap_leader("fs", function() MiniPick.builtin.lsp({ scope = "workspace_symbol_live" }) end, "Symbols workspace (live)")
|
|
nmap_leader("fS", function() MiniPick.builtin.lsp({ scope = "document_symbol" }) end, "Symbols document")
|
|
|
|
-- Git =====================================================================
|
|
nmap_leader("go", function() MiniDiff.toggle_overlay() end, "Toggle overlay")
|
|
|
|
-- HTTP =====================================================================
|
|
nmap_leader("hr", lazy_setup("kulala", function() require("kulala").run() end), "Send HTTP request")
|
|
|
|
-- Language =====================================================================
|
|
nmap_leader("la", vim.lsp.buf.code_action, "Actions")
|
|
nmap_leader("ld", vim.diagnostic.open_float, "Diagnostic popup")
|
|
nmap_leader("lf", function() require("conform").format() end, "Format")
|
|
nmap_leader("li", vim.lsp.buf.implementation, "Implementation")
|
|
nmap_leader("lh", vim.lsp.buf.hover, "Hover")
|
|
nmap_leader("ll", vim.lsp.codelens.run, "Lens")
|
|
nmap_leader("lr", vim.lsp.buf.rename, "Rename")
|
|
nmap_leader("lR", vim.lsp.buf.references, "References")
|
|
nmap_leader("ls", vim.lsp.buf.definition, "Source definition")
|
|
nmap_leader("lt", vim.lsp.buf.type_definition, "Type definition")
|
|
xmap_leader("lf", function() require("conform").format() end, "Format selection")
|
|
|
|
-- Run =====================================================================
|
|
nmap_leader("r", function() require("just").pick_just_task() end, "Run Just Task")
|
|
|
|
-- Session =====================================================================
|
|
nmap_leader("sd", function() MiniSessions.select("delete") end, "Delete")
|
|
nmap_leader("sn", function() vim.ui.input({ prompt = "Session name: " }, MiniSessions.write) end, "New")
|
|
nmap_leader("sr", function() MiniSessions.select("read") end, "Read")
|
|
nmap_leader("sR", function() MiniSessions.restart() end, "Restart")
|
|
nmap_leader("sw", function() MiniSessions.write() end, "Write current")
|
|
|
|
-- Terminal =====================================================================
|
|
nmap_leader("tT", function() vim.cmd("horizontal term") end, "Terminal (horizontal)")
|
|
nmap_leader("tt", function() vim.cmd("vertical term") end, "Terminal (vertical)")
|
|
nmap_leader("tg", function() require("terminal").open_terminal_app("lazygit") end, "LazyGit")
|
|
nmap_leader("ts", function() require("terminal").open_terminal_app("lazysql") end, "LazySQL")
|
|
|
|
-- Overwrites =====================================================================
|
|
nmap("<Esc>", function() vim.cmd("nohlsearch") end, "Clear search highlights")
|