local M = {} M.maps = { general = { n = { -- normal mode -- Better window navigation { "", "h" }, { "", "j" }, { "", "k" }, { "", "l" }, -- Resize with arrows { "", ":resize -2" }, { "", ":resize +2" }, { "", ":vertical resize -2" }, { "", ":vertical resize +2" }, -- Navigate buffers { "", ":bnext" }, { "", ":bprevious" }, -- lsp { "gD", "lua vim.lsp.buf.declaration()" }, { "gd", "lua vim.lsp.buf.definition()" }, { "K", "lua vim.lsp.buf.hover()" }, { "gI", "lua vim.lsp.buf.implementation()" }, { "gr", "lua vim.lsp.buf.references()" }, { "gl", "lua vim.diagnostic.open_float()" }, }, i = { -- insert mode -- Delete last word with ctrl + del { "", "" }, }, v = { -- visual mode -- Better paste { "p", '"_dP' }, -- Stay in indent mode { "<", "", ">gv" }, } }, illuminate = { n = { { "", "lua require('illuminate').next_reference{wrap=true}" }, { "", "lua require('illuminate').next_reference{reverse=true,wrap=true}" }, } }, } M.whichkey = { general = { n = { ["w"] = { "w!", "Save" }, ["q"] = { function() require("funcs").buf_kill() end, "Close" }, ["f"] = { function() require("lf").start("~") end, "File Picker" }, ["h"] = { "nohlsearch", "Clear Highlights" }, u = { name = "Utility", c = { "w!!compiler \"%:p\"", "Compile" }, }, l = { name = "LSP", a = { function() vim.lsp.buf.code_action() end, "Code Action" }, f = { function() require("funcs").format { async = true } end, "Format" }, 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" }, } } }, lspconfig = { n = { l = { name = "LSP", i = { "LspInfo", "Info" }, } } }, mason = { n = { l = { name = "LSP", I = { "Mason", "Mason Info" }, } } }, dap = { n = { 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" }, t = { function() require("dap").terminate() end, "Stop Debugger" }, u = { function() require("dapui").toggle() end, "Toggle DAP UI" }, } } }, telescope = { n = { b = { name = "Buffers", f = { "Telescope buffers", "Find" }, }, g = { name = "Git", 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)" }, }, l = { name = "LSP", d = { "Telescope diagnostics bufnr=0 theme=get_ivy", "Buffer Diagnostics" }, w = { "Telescope diagnostics", "Diagnostics" }, s = { "Telescope lsp_document_symbols", "Document Symbols" }, S = { "Telescope lsp_dynamic_workspace_symbols", "Workspace Symbols" }, e = { "Telescope quickfix", "Telescope Quickfix" }, }, s = { name = "Search", 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" }, T = { "TodoTelescope", "Todo Comments" }, k = { "Telescope keymaps", "Keymaps" }, C = { "Telescope commands", "Commands" }, } } }, blankline = { n = { c = { function() local ok, start = require("indent_blankline.utils").get_current_context( vim.g.indent_blankline_context_patterns, vim.g.indent_blankline_use_treesitter_scope ) if ok then vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) vim.cmd [[normal! _]] end end, "Jump to current_context", } } }, bufferline = { n = { b = { name = "Buffers", j = { "BufferLinePick", "Jump" }, 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" }, }, } }, packer = { n = { p = { name = "Packer", c = { "PackerCompile", "Compile" }, C = { "PackerClean", "Clean" }, i = { "PackerInstall", "Install" }, s = { "PackerSync", "Sync" }, S = { "PackerStatus", "Status" }, u = { "PackerUpdate", "Update" }, }, } }, lf = { n = { ["e"] = { function() require("lf").start() end, "File Picker" }, } }, alpha = { n = { [";"] = { "Alpha", "Dashboard" }, } }, treesitter = { n = { T = { name = "Treesitter", i = { "TSConfigInfo", "Info" }, }, } }, comment = { n = { ["/"] = { "(comment_toggle_linewise_current)", "Comment toggle current line" }, }, v = { ["/"] = { "(comment_toggle_linewise_visual)", "Comment toggle linewise" }, }, }, gitsigns = { n = { 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" }, d = { "Gitsigns diffthis HEAD", "Git Diff" }, }, } } } return M