local kbopts = { silent = true, noremap = true } return { kb = { ['n'] = { -- normal mode -- Better window navigation {"", "h", kbopts}, {"", "j", kbopts}, {"", "k", kbopts}, {"", "l", kbopts}, -- Resize with arrows {"", ":resize -2", kbopts}, {"", ":resize +2", kbopts}, {"", ":vertical resize -2", kbopts}, {"", ":vertical resize +2", kbopts}, -- Navigate buffers {"", ":bnext", kbopts}, {"", ":bprevious", kbopts}, -- LSP {"gD", "lua vim.lsp.buf.declaration()", kbopts}, {"gd", "lua vim.lsp.buf.definition()", kbopts}, {"K", "lua vim.lsp.buf.hover()", kbopts}, {"gI", "lua vim.lsp.buf.implementation()", kbopts}, {"gr", "lua vim.lsp.buf.references()", kbopts}, {"gl", "lua vim.diagnostic.open_float()", kbopts}, -- Illuminate {'', "lua require('illuminate').next_reference{wrap=true}", kbopts}, {'', "lua require('illuminate').next_reference{reverse=true,wrap=true}", kbopts}, }, ['i'] = { -- insert mode -- Delete last word with ctrl + del {"", "", kbopts}, }, ['v'] = { -- visual mode -- Better paste {"p", '"_dP', kbopts}, -- Stay in indent mode {"<", "", ">gv", kbopts}, }, ['x'] = { -- visual block mode }, ['t'] = { -- terminal mode }, ['c'] = { -- command mode } }, wk = { vopts = { mode = "n", prefix = "", buffer = nil, silent = true, noremap = true, nowait = true, }, nopts = { mode = "n", prefix = "", buffer = nil, silent = true, noremap = true, nowait = true, }, vmaps = { ["/"] = { "(comment_toggle_linewise_visual)", "Comment toggle linewise (visual)" }, }, nmaps = { [";"] = { "Alpha", "Dashboard" }, ["/"] = { "(comment_toggle_linewise_current)", "Comment toggle current line" }, ["w"] = { "w!", "Save" }, ["c"] = { function() require("user.funcs").buf_kill() end, "Close" }, -- TODO: filepicker ["f"] = {}, ["h"] = { "nohlsearch", "Clear Highlights" }, ["e"] = { "NvimTreeToggle", "Toggle Filetree" }, b = { name = "Buffers", j = { "BufferLinePick", "Jump" }, f = { "Telescope buffers", "Find" }, b = { "BufferLineCyclePrev", "Previous" }, n = { "BufferLineCycleNext", "Next" }, e = { "BufferLinePickClose", "Pick which buffer to close" }, h = { "BufferLineCloseLeft", "Close all to the left" }, l = { "BufferLineCloseRight", "Close all to the right" }, D = { "BufferLineSortByDirectory", "Sort by directory" }, L = { "BufferLineSortByExtension", "Sort by language" }, }, p = { name = "Packer", c = { "PackerCompile", "Compile" }, i = { "PackerInstall", "Install" }, s = { "PackerSync", "Sync" }, S = { "PackerStatus", "Status" }, u = { "PackerUpdate", "Update" }, }, t = { name = "Todo Comments", j = { function() require("todo-comments").jump_next() end, "Next Comment" }, k = { function() require("todo-comments").jump_prev() end, "Previous Comment" }, }, g = { name = "Git", j = { function() require("gitsigns").next_hunk() end, "Next Hunk" }, k = { function() require("gitsigns").prev_hunk() end, "Prev Hunk" }, l = { function() require("gitsigns").blame_line() end, "Blame" }, p = { function() require("gitsigns").preview_hunk() end, "Preview Hunk" }, r = { function() require("gitsigns").reset_hunk() end, "Reset Hunk" }, R = { function() require("gitsigns").reset_buffer() end, "Reset Buffer" }, s = { function() require("gitsigns").stage_hunk() end, "Stage Hunk" }, u = { function() require("gitsigns").undo_stage_hunk() end, "Undo Stage Hunk" }, o = { "Telescope git_status", "Open changed file" }, b = { "Telescope git_branches", "Checkout branch" }, c = { "Telescope git_commits", "Checkout commit" }, C = { "Telescope git_bcommits", "Checkout commit(for current file)" }, d = { "Gitsigns diffthis HEAD", "Git Diff" }, }, l = { name = "LSP", a = { function() vim.lsp.buf.code_action() end, "Code Action" }, d = { "Telescope diagnostics bufnr=0 theme=get_ivy", "Buffer Diagnostics" }, w = { "Telescope diagnostics", "Diagnostics" }, f = { function() vim.lsp.buf.format{ async = true }() end, "Format" }, i = { "LspInfo", "Info" }, I = { "Mason", "Mason Info" }, j = { function() vim.diagnostic.goto_next() end, "Next Diagnostic" }, k = { function() vim.diagnostic.goto_prev() end, "Prev Diagnostic" }, l = { function() vim.lsp.codelens.run() end, "CodeLens Action" }, q = { function() vim.diagnostic.setloclist() end, "Quickfix" }, r = { function() vim.lsp.buf.rename() end, "Rename" }, s = { "Telescope lsp_document_symbols", "Document Symbols" }, S = { "Telescope lsp_dynamic_workspace_symbols", "Workspace Symbols" }, e = { "Telescope quickfix", "Telescope Quickfix" }, }, d = { name = "DAP", b = { function() require('dap').toggle_breakpoint() end, "Toggle Breakpoint"}, c = { function() require('dap').continue() end, "Continue"}, i = { function() require('dap').step_into() end, "Step Into"}, o = { function() require('dap').step_over() end, "Step Over"}, O = { function() require('dap').step_out() end, "Step Out"}, r = { function() require('dap').repl.toggle() end, "Toggle REPL"}, l = { function() require('dap').run_last() end, "Run Last"}, u = { function() require('dapui').toggle() end, "Toggle DAP UI"}, t = { function() require('dap').terminate() end, "Stop Debugger"}, }, u = { name = "Utility", c = { "w!!compiler \"%:p\"", "Compile" }, }, s = { name = "Search", b = { "Telescope git_branches", "Checkout branch" }, c = { "Telescope colorscheme", "Colorscheme" }, f = { "Telescope find_files", "Find File" }, h = { "Telescope help_tags", "Find Help" }, H = { "Telescope highlights", "Find highlight groups" }, M = { "Telescope man_pages", "Man Pages" }, r = { "Telescope oldfiles", "Open Recent File" }, R = { "Telescope registers", "Registers" }, t = { "Telescope live_grep", "Text" }, k = { "Telescope keymaps", "Keymaps" }, C = { "Telescope commands", "Commands" }, }, T = { name = "Treesitter", i = { "TSConfigInfo", "Info" }, }, } } }