2024-01-27 20:36:46 +01:00
|
|
|
local M = {}
|
2024-01-24 10:53:48 +01:00
|
|
|
local f = require("funcs")
|
2024-01-25 00:10:11 +01:00
|
|
|
local icons = require("config.icons")
|
2023-11-23 21:27:17 +01:00
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
local maps = f.empty_map_table()
|
2024-01-27 20:36:46 +01:00
|
|
|
|
|
|
|
M.sections = {
|
2024-01-26 17:21:37 +01:00
|
|
|
p = { desc = icons.Package .. " Packages" },
|
|
|
|
b = { desc = icons.Buffer .. " Buffers" },
|
|
|
|
bs = { desc = "Sort Buffers" },
|
|
|
|
d = { desc = icons.Bug .. " Debugger" },
|
|
|
|
g = { desc = icons.Git .. " Git" },
|
|
|
|
f = { desc = icons.Search .. " Find" },
|
|
|
|
l = { desc = icons.Code .. " LSP" },
|
|
|
|
t = { desc = icons.Console .. " Terminal" },
|
2024-01-28 13:45:35 +01:00
|
|
|
u = { desc = icons.Gear .. " Utility" },
|
|
|
|
n = { desc = icons.Note .. " Notes" },
|
2023-11-23 21:27:17 +01:00
|
|
|
}
|
|
|
|
|
2024-01-24 00:48:37 +01:00
|
|
|
-- Standard --
|
|
|
|
maps.n["j"] = { "v:count == 0 ? 'gj' : 'j'", expr = true, desc = "Move cursor down" }
|
|
|
|
maps.n["k"] = { "v:count == 0 ? 'gk' : 'k'", expr = true, desc = "Move cursor up" }
|
|
|
|
maps.n["<Leader>w"] = { "<Cmd>w<CR>", desc = "Write buffer" }
|
2024-01-25 00:10:11 +01:00
|
|
|
maps.n["<Leader>c"] = { "<Cmd>conf q<CR>", desc = "Quit" }
|
|
|
|
maps.n["<Leader>C"] = { "<Cmd>conf qa<CR>", desc = "Quit all" }
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<Leader>n"] = { "<Cmd>ene<CR>", desc = "New buffer" }
|
2024-01-25 00:10:11 +01:00
|
|
|
maps.n["<Leader>h"] = { "<Cmd>noh<CR>", desc = "Clear highlight" }
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<C-s>"] = { "<Cmd>w!<cr>", desc = "Force write buffer" }
|
|
|
|
maps.n["<C-q>"] = { "<Cmd>qa!<cr>", desc = "Force quit all" }
|
|
|
|
maps.n["|"] = { "<Cmd>vsplit<cr>", desc = "Vertical split" }
|
|
|
|
maps.n["\\"] = { "<Cmd>split<cr>", desc = "Horizontal split" }
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.v["<"] = { "<gv", desc = "Unindent line" }
|
|
|
|
maps.v[">"] = { ">gv", desc = "Indent line" }
|
2024-01-25 00:10:11 +01:00
|
|
|
maps.n["<Leader>q"] = { f.buf_close, desc = "Close buffer" }
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<C-b>"] = { "<C-a>" }
|
|
|
|
maps.n["<C-f>"] = { "<Nop>" }
|
|
|
|
maps.i["<C-h>"] = { "<C-W>" }
|
|
|
|
|
2024-01-27 20:36:46 +01:00
|
|
|
-- Utility --
|
2024-01-28 13:45:35 +01:00
|
|
|
if f.is_available("nvim-colorizer.lua") then
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<Leader>u"] = M.sections.u
|
|
|
|
maps.n["<Leader>uc"] = { "<Cmd>ColorizerToggle<CR>", desc = "Toggle colorizer" }
|
|
|
|
end
|
|
|
|
|
2024-01-28 13:45:35 +01:00
|
|
|
-- Notes --
|
|
|
|
if f.is_available("zk-nvim") then
|
|
|
|
maps.n["<Leader>n"] = M.sections.n
|
2024-01-28 15:04:25 +01:00
|
|
|
maps.n["<Leader>nn"] = {
|
|
|
|
function() require("zk").new({ notebook_path = vim.g.wikidir, title = vim.fn.input('Title: ') }) end,
|
|
|
|
desc = "New Note"
|
|
|
|
}
|
|
|
|
maps.n["<Leader>no"] = {
|
|
|
|
function() require("zk").edit({ notebook_path = vim.g.wikidir }) end,
|
|
|
|
desc = "Open Note"
|
|
|
|
}
|
|
|
|
maps.n["<Leader>ni"] = {
|
|
|
|
function() require("zk").index({ notebook_path = vim.g.wikidir }) end,
|
|
|
|
desc = "Index Notes"
|
|
|
|
}
|
2024-01-28 13:45:35 +01:00
|
|
|
end
|
|
|
|
|
2024-01-24 00:48:37 +01:00
|
|
|
-- Window Navigation --
|
|
|
|
maps.n["<C-h>"] = { "<C-w>h", desc = "Move to left split" }
|
|
|
|
maps.n["<C-j>"] = { "<C-w>j", desc = "Move to below split" }
|
|
|
|
maps.n["<C-k>"] = { "<C-w>k", desc = "Move to above split" }
|
|
|
|
maps.n["<C-l>"] = { "<C-w>l", desc = "Move to right split" }
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<C-Up>"] = { "<Cmd>resize -2<CR>", desc = "Resize split up" }
|
|
|
|
maps.n["<C-Down>"] = { "<Cmd>resize +2<CR>", desc = "Resize split down" }
|
|
|
|
maps.n["<C-Left>"] = { "<Cmd>vertical resize -2<CR>", desc = "Resize split left" }
|
|
|
|
maps.n["<C-Right>"] = { "<Cmd>vertical resize +2<CR>", desc = "Resize split right" }
|
|
|
|
maps.t["<C-h>"] = { "<Cmd>wincmd h<cr>", desc = "Terminal left window navigation" }
|
|
|
|
maps.t["<C-j>"] = { "<Cmd>wincmd j<cr>", desc = "Terminal down window navigation" }
|
|
|
|
maps.t["<C-k>"] = { "<Cmd>wincmd k<cr>", desc = "Terminal up window navigation" }
|
|
|
|
maps.t["<C-l>"] = { "<Cmd>wincmd l<cr>", desc = "Terminal right window navigation" }
|
2024-01-24 00:48:37 +01:00
|
|
|
|
|
|
|
-- Plugin Manager --
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<Leader>p"] = M.sections.p
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<Leader>ph"] = { function() require("lazy").home() end, desc = "Home" }
|
|
|
|
maps.n["<Leader>pi"] = { function() require("lazy").install() end, desc = "Install" }
|
|
|
|
maps.n["<Leader>pu"] = { function() require("lazy").update() end, desc = "Update" }
|
|
|
|
maps.n["<Leader>ps"] = { function() require("lazy").sync() end, desc = "Sync" }
|
|
|
|
maps.n["<Leader>px"] = { function() require("lazy").clean() end, desc = "Clean" }
|
|
|
|
maps.n["<Leader>pc"] = { function() require("lazy").check() end, desc = "Check" }
|
|
|
|
maps.n["<Leader>pl"] = { function() require("lazy").log() end, desc = "Log" }
|
|
|
|
maps.n["<Leader>pr"] = { function() require("lazy").restore() end, desc = "Restore" }
|
|
|
|
maps.n["<Leader>pp"] = { function() require("lazy").profile() end, desc = "Profile" }
|
|
|
|
maps.n["<Leader>pd"] = { function() require("lazy").debug() end, desc = "Debug" }
|
|
|
|
maps.n["<Leader>p?"] = { function() require("lazy").help() end, desc = "Help" }
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available("bufferline.nvim") then
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<S-l>"] = { function() require("bufferline").cycle(1) end, desc = "Switch to next buffer" }
|
|
|
|
maps.n["<S-h>"] = { function() require("bufferline").cycle(-1) end, desc = "Switch to previous buffer" }
|
|
|
|
maps.n["<A-l>"] = { function() require("bufferline").move(1) end, desc = "Move buffer to next" }
|
|
|
|
maps.n["<A-h>"] = { function() require("bufferline").move(-1) end, desc = "Move buffer to previous" }
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<Leader>b"] = M.sections.b
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<Leader>bc"] = { function() require("bufferline").close_others() end, desc = "Close other buffers" }
|
|
|
|
maps.n["<Leader>bl"] = {
|
|
|
|
function() require("bufferline").close_in_direction("left") end,
|
|
|
|
desc = "Close lefthand buffers"
|
|
|
|
}
|
|
|
|
maps.n["<Leader>br"] = {
|
|
|
|
function() require("bufferline").close_in_direction("right") end,
|
|
|
|
desc = "Close righthand buffers"
|
|
|
|
}
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<Leader>bs"] = M.sections.bs
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<Leader>bse"] = { function() require("bufferline").sort_by("extension") end, desc = "By extension" }
|
|
|
|
maps.n["<Leader>bsd"] = { function() require("bufferline").sort_by("directory") end, desc = "By directory" }
|
|
|
|
maps.n["<Leader>bsr"] = {
|
|
|
|
function() require("bufferline").sort_by("relative_directory") end,
|
|
|
|
desc = "By relative directory"
|
|
|
|
}
|
|
|
|
maps.n["<Leader>bst"] = { function() require("bufferline").sort_by("tabs") end, desc = "By tabs" }
|
|
|
|
end
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available("Comment.nvim") then
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<Leader>/"] = {
|
|
|
|
function() require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1) end,
|
|
|
|
desc = "Toggle comment line",
|
|
|
|
}
|
|
|
|
maps.v["<Leader>/"] = {
|
2024-01-27 20:36:46 +01:00
|
|
|
"<esc><Cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
|
2024-01-24 00:48:37 +01:00
|
|
|
desc = "Toggle comment for selection",
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available("gitsigns.nvim") then
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<Leader>g"] = M.sections.g
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["]g"] = { function() require("gitsigns").next_hunk() end, desc = "Next Git hunk" }
|
|
|
|
maps.n["[g"] = { function() require("gitsigns").prev_hunk() end, desc = "Previous Git hunk" }
|
|
|
|
maps.n["<Leader>gl"] = { function() require("gitsigns").blame_line() end, desc = "View Git blame" }
|
|
|
|
maps.n["<Leader>gL"] = { function() require("gitsigns").blame_line { full = true } end, desc = "View full Git blame" }
|
|
|
|
maps.n["<Leader>gp"] = { function() require("gitsigns").preview_hunk() end, desc = "Preview Git hunk" }
|
|
|
|
maps.n["<Leader>gh"] = { function() require("gitsigns").reset_hunk() end, desc = "Reset Git hunk" }
|
|
|
|
maps.n["<Leader>gr"] = { function() require("gitsigns").reset_buffer() end, desc = "Reset Git buffer" }
|
|
|
|
maps.n["<Leader>gs"] = { function() require("gitsigns").stage_hunk() end, desc = "Stage Git hunk" }
|
|
|
|
maps.n["<Leader>gS"] = { function() require("gitsigns").stage_buffer() end, desc = "Stage Git buffer" }
|
|
|
|
maps.n["<Leader>gu"] = { function() require("gitsigns").undo_stage_hunk() end, desc = "Unstage Git hunk" }
|
|
|
|
maps.n["<Leader>gd"] = { function() require("gitsigns").diffthis() end, desc = "View Git diff" }
|
|
|
|
end
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available("lf.nvim") then
|
2024-01-25 00:10:11 +01:00
|
|
|
maps.n["<Leader>e"] = { "<Cmd>Lf<CR>", desc = "File manager" }
|
2024-01-24 00:48:37 +01:00
|
|
|
end
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available("mason.nvim") then
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<Leader>pm"] = { "<Cmd>Mason<cr>", desc = "Mason" }
|
2024-01-24 00:48:37 +01:00
|
|
|
end
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available "aerial.nvim" then
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<leader>l"] = M.sections.l
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<leader>lS"] = { function() require("aerial").toggle() end, desc = "Symbols outline" }
|
|
|
|
end
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available("telescope.nvim") then
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<Leader>f"] = M.sections.f
|
|
|
|
maps.n["<Leader>g"] = M.sections.g
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<Leader>gb"] = {
|
|
|
|
function() require("telescope.builtin").git_branches { use_file_path = true } end,
|
|
|
|
desc = "Git branches"
|
|
|
|
}
|
|
|
|
maps.n["<Leader>gc"] = {
|
|
|
|
function() require("telescope.builtin").git_commits { use_file_path = true } end,
|
|
|
|
desc = "Git commits (repository)",
|
|
|
|
}
|
|
|
|
maps.n["<Leader>gC"] = {
|
|
|
|
function() require("telescope.builtin").git_bcommits { use_file_path = true } end,
|
|
|
|
desc = "Git commits (current file)",
|
|
|
|
}
|
|
|
|
maps.n["<Leader>gt"] = {
|
|
|
|
function() require("telescope.builtin").git_status { use_file_path = true } end,
|
|
|
|
desc = "Git status"
|
|
|
|
}
|
|
|
|
maps.n["<Leader>f<CR>"] = { function() require("telescope.builtin").resume() end, desc = "Resume previous search" }
|
|
|
|
maps.n["<Leader>f'"] = { function() require("telescope.builtin").marks() end, desc = "Find marks" }
|
|
|
|
maps.n["<Leader>f/"] = {
|
|
|
|
function() require("telescope.builtin").current_buffer_fuzzy_find() end,
|
|
|
|
desc = "Find words in current buffer"
|
|
|
|
}
|
|
|
|
maps.n["<Leader>fc"] = { function() require("telescope.builtin").grep_string() end, desc = "Find word under cursor" }
|
|
|
|
maps.n["<Leader>fC"] = { function() require("telescope.builtin").commands() end, desc = "Find commands" }
|
|
|
|
maps.n["<Leader>ff"] = { function() require("telescope.builtin").find_files() end, desc = "Find files" }
|
|
|
|
maps.n["<Leader>fF"] = {
|
2024-01-27 18:45:02 +01:00
|
|
|
function() require("telescope.builtin").find_files({ hidden = true, no_ignore = true }) end,
|
2024-01-24 00:48:37 +01:00
|
|
|
desc = "Find all files",
|
|
|
|
}
|
|
|
|
maps.n["<Leader>fh"] = { function() require("telescope.builtin").help_tags() end, desc = "Find help" }
|
|
|
|
maps.n["<Leader>fk"] = { function() require("telescope.builtin").keymaps() end, desc = "Find keymaps" }
|
|
|
|
maps.n["<Leader>fm"] = { function() require("telescope.builtin").man_pages() end, desc = "Find man" }
|
|
|
|
maps.n["<Leader>fo"] = { function() require("telescope.builtin").oldfiles() end, desc = "Find history" }
|
|
|
|
maps.n["<Leader>fr"] = { function() require("telescope.builtin").registers() end, desc = "Find registers" }
|
|
|
|
maps.n["<Leader>fw"] = { function() require("telescope.builtin").live_grep() end, desc = "Find words" }
|
2024-01-27 18:45:02 +01:00
|
|
|
-- maps.n["<Leader>fb"] = { function() require("telescope.builtin").buffers() end, desc = "Find buffers" }
|
2024-01-28 15:04:25 +01:00
|
|
|
maps.n["<Leader>ft"] = {
|
|
|
|
function() require("telescope").extensions["todo-comments"].todo() end,
|
|
|
|
desc =
|
|
|
|
"Find buffers"
|
|
|
|
}
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<Leader>fW"] = {
|
|
|
|
function()
|
2024-01-27 18:45:02 +01:00
|
|
|
require("telescope.builtin").live_grep({
|
2024-01-24 00:48:37 +01:00
|
|
|
additional_args = function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end,
|
2024-01-27 18:45:02 +01:00
|
|
|
})
|
2024-01-24 00:48:37 +01:00
|
|
|
end,
|
|
|
|
desc = "Find words in all files",
|
|
|
|
}
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<Leader>l"] = M.sections.l
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<Leader>ls"] = {
|
|
|
|
function()
|
|
|
|
local aerial_avail, _ = pcall(require, "aerial")
|
|
|
|
if aerial_avail then
|
|
|
|
require("telescope").extensions.aerial.aerial()
|
|
|
|
else
|
|
|
|
require("telescope.builtin").lsp_document_symbols()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
desc = "Search symbols",
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available("toggleterm.nvim") then
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<leader>t"] = M.sections.t
|
2024-01-24 00:48:37 +01:00
|
|
|
if vim.fn.executable "lazygit" == 1 then
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<leader>g"] = M.sections.g
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<leader>gg"] = {
|
|
|
|
function()
|
2024-01-24 10:53:48 +01:00
|
|
|
local worktree = f.file_worktree()
|
2024-01-24 00:48:37 +01:00
|
|
|
local flags = worktree
|
|
|
|
and (" --work-tree=%s --git-dir=%s"):format(worktree.toplevel, worktree.gitdir)
|
|
|
|
or ""
|
2024-01-24 10:53:48 +01:00
|
|
|
f.toggle_term_cmd("lazygit " .. flags)
|
2024-01-24 00:48:37 +01:00
|
|
|
end,
|
|
|
|
desc = "ToggleTerm lazygit",
|
|
|
|
}
|
|
|
|
maps.n["<leader>tl"] = maps.n["<leader>gg"]
|
|
|
|
end
|
|
|
|
if vim.fn.executable "node" == 1 then
|
2024-01-24 10:53:48 +01:00
|
|
|
maps.n["<leader>tn"] = { function() f.toggle_term_cmd "node" end, desc = "ToggleTerm node" }
|
2024-01-24 00:48:37 +01:00
|
|
|
end
|
|
|
|
if vim.fn.executable("gdu") == 1 then
|
2024-01-24 10:53:48 +01:00
|
|
|
maps.n["<leader>tu"] = { function() f.toggle_term_cmd("gdu") end, desc = "ToggleTerm gdu" }
|
2024-01-24 00:48:37 +01:00
|
|
|
end
|
|
|
|
if vim.fn.executable "btm" == 1 then
|
2024-01-24 10:53:48 +01:00
|
|
|
maps.n["<leader>tt"] = { function() f.toggle_term_cmd "btm" end, desc = "ToggleTerm btm" }
|
2023-11-23 21:27:17 +01:00
|
|
|
end
|
2024-01-24 00:48:37 +01:00
|
|
|
local python = vim.fn.executable "python" == 1 and "python" or vim.fn.executable "python3" == 1 and "python3"
|
2024-01-24 10:53:48 +01:00
|
|
|
if python then maps.n["<leader>tp"] = { function() f.toggle_term_cmd(python) end, desc = "ToggleTerm python" } end
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<leader>tf"] = { "<Cmd>ToggleTerm direction=float<cr>", desc = "ToggleTerm float" }
|
|
|
|
maps.n["<leader>th"] = { "<Cmd>ToggleTerm size=10 direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
|
|
|
|
maps.n["<leader>tv"] = { "<Cmd>ToggleTerm size=80 direction=vertical<cr>", desc = "ToggleTerm vertical split" }
|
|
|
|
maps.n["<F7>"] = { "<Cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.t["<F7>"] = maps.n["<F7>"]
|
|
|
|
-- TODO: Patch st: https://st.suckless.org/patches/fix_keyboard_input/
|
|
|
|
-- maps.n["<C-'>"] = maps.n["<F7>"]
|
2024-01-26 12:42:12 +01:00
|
|
|
-- maps.t["<C-'>"] = maps.t["<F7>"]
|
|
|
|
maps.n["<C-z>"] = maps.n["<F7>"]
|
|
|
|
maps.t["<C-z>"] = maps.t["<F7>"]
|
2023-11-23 21:27:17 +01:00
|
|
|
end
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available "nvim-dap" then
|
2024-01-24 00:48:37 +01:00
|
|
|
local conditional_breakpoint = function()
|
|
|
|
vim.ui.input({ prompt = "Condition: " }, function(condition)
|
|
|
|
if condition then require("dap").set_breakpoint(condition) end
|
|
|
|
end)
|
|
|
|
end
|
2024-01-27 20:36:46 +01:00
|
|
|
maps.n["<leader>d"] = M.sections.d
|
|
|
|
maps.v["<leader>d"] = M.sections.d
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<F5>"] = { function() require("dap").continue() end, desc = "Debugger: Start" }
|
|
|
|
maps.n["<S-F5>"] = { function() require("dap").terminate() end, desc = "Debugger: Stop" }
|
|
|
|
maps.n["<S-F9>"] = { conditional_breakpoint, desc = "Debugger: Conditional Breakpoint" }
|
|
|
|
maps.n["<C-F5>"] = { function() require("dap").restart_frame() end, desc = "Debugger: Restart" }
|
|
|
|
maps.n["<F6>"] = { function() require("dap").pause() end, desc = "Debugger: Pause" }
|
|
|
|
maps.n["<F9>"] = { function() require("dap").toggle_breakpoint() end, desc = "Debugger: Toggle Breakpoint" }
|
|
|
|
maps.n["<F10>"] = { function() require("dap").step_over() end, desc = "Debugger: Step Over" }
|
|
|
|
maps.n["<F11>"] = { function() require("dap").step_into() end, desc = "Debugger: Step Into" }
|
|
|
|
maps.n["<S-F11>"] = { function() require("dap").step_out() end, desc = "Debugger: Step Out" }
|
|
|
|
maps.n["<leader>db"] = { function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint (F9)" }
|
|
|
|
maps.n["<leader>dB"] = { function() require("dap").clear_breakpoints() end, desc = "Clear Breakpoints" }
|
|
|
|
maps.n["<leader>dc"] = { function() require("dap").continue() end, desc = "Start/Continue (F5)" }
|
|
|
|
maps.n["<leader>dC"] = { conditional_breakpoint, desc = "Conditional Breakpoint (S-F9)" }
|
|
|
|
maps.n["<leader>di"] = { function() require("dap").step_into() end, desc = "Step Into (F11)" }
|
|
|
|
maps.n["<leader>do"] = { function() require("dap").step_over() end, desc = "Step Over (F10)" }
|
|
|
|
maps.n["<leader>dO"] = { function() require("dap").step_out() end, desc = "Step Out (S-F11)" }
|
|
|
|
maps.n["<leader>dq"] = { function() require("dap").close() end, desc = "Close Session" }
|
|
|
|
maps.n["<leader>dQ"] = { function() require("dap").terminate() end, desc = "Terminate Session (S-F5)" }
|
|
|
|
maps.n["<leader>dp"] = { function() require("dap").pause() end, desc = "Pause (F6)" }
|
|
|
|
maps.n["<leader>dr"] = { function() require("dap").restart_frame() end, desc = "Restart (C-F5)" }
|
|
|
|
maps.n["<leader>dR"] = { function() require("dap").repl.toggle() end, desc = "Toggle REPL" }
|
|
|
|
maps.n["<leader>ds"] = { function() require("dap").run_to_cursor() end, desc = "Run To Cursor" }
|
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available "nvim-dap-ui" then
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["<leader>dE"] = {
|
|
|
|
function()
|
|
|
|
vim.ui.input({ prompt = "Expression: " }, function(expr)
|
|
|
|
if expr then require("dapui").eval(expr, { enter = true }) end
|
|
|
|
end)
|
|
|
|
end,
|
|
|
|
desc = "Evaluate Input",
|
|
|
|
}
|
|
|
|
maps.v["<leader>dE"] = { function() require("dapui").eval() end, desc = "Evaluate Input" }
|
|
|
|
maps.n["<leader>du"] = { function() require("dapui").toggle() end, desc = "Toggle Debugger UI" }
|
|
|
|
maps.n["<leader>dh"] = { function() require("dap.ui.widgets").hover() end, desc = "Debugger Hover" }
|
|
|
|
end
|
2023-11-23 21:27:17 +01:00
|
|
|
end
|
2024-01-24 00:48:37 +01:00
|
|
|
|
2024-01-24 10:53:48 +01:00
|
|
|
if f.is_available "nvim-ufo" then
|
2024-01-24 00:48:37 +01:00
|
|
|
maps.n["zR"] = { function() require("ufo").openAllFolds() end, desc = "Open all folds" }
|
|
|
|
maps.n["zM"] = { function() require("ufo").closeAllFolds() end, desc = "Close all folds" }
|
|
|
|
maps.n["zr"] = { function() require("ufo").openFoldsExceptKinds() end, desc = "Fold less" }
|
|
|
|
maps.n["zm"] = { function() require("ufo").closeFoldsWith() end, desc = "Fold more" }
|
|
|
|
maps.n["zp"] = { function() require("ufo").peekFoldedLinesUnderCursor() end, desc = "Peek fold" }
|
|
|
|
end
|
|
|
|
|
2024-01-27 20:36:46 +01:00
|
|
|
M.maps = maps
|
|
|
|
|
|
|
|
return M
|