---@type MappingsTable local M = {} -- NOTE: The mappings here are case sensitive!!! Removing a specific default -- mapping requires the same case here! M.disabled = { n = { [""] = "", [""] = "", [""] = "", ["n"] = "", ["rn"] = "", [""] = "", [""] = "", ["x"] = "", ["/"] = "", ["ra"] = "", ["[d"] = "", ["]d"] = "", ["[c"] = "", ["]c"] = "", ["h"] = "", ["ff"] = "", ["fm"] = "", ["fa"] = "", ["fw"] = "", ["fb"] = "", ["th"] = "", ["fh"] = "", ["fo"] = "", ["fz"] = "", ["cm"] = "", ["gt"] = "", ["pt"] = "", ["ma"] = "", ["v"] = "", ["rh"] = "", ["ph"] = "", ["gb"] = "", ["td"] = "", ["wk"] = "", ["#"] = "", ["J"] = "", }, t = { [""] = "", }, v = { ["#"] = "", ["?"] = "", ["/"] = "", ["J"] = "", }, } M.tabufline = { plugin = true, n = { -- cycle through buffers [""] = { function() require("nvchad.tabufline").tabuflineNext() end, "Goto next buffer", }, [""] = { function() require("nvchad.tabufline").tabuflinePrev() end, "Goto prev buffer", }, -- close buffer + hide terminal buffer [""] = { function() require("nvchad.tabufline").close_buffer() end, "Close buffer", }, }, } M.comment = { plugin = true, -- toggle comment in both modes n = { ["v"] = { function() require("Comment.api").toggle.linewise.current() end, "Toggle comment", }, }, v = { ["v"] = { "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", "Toggle comment", }, }, } M.leap = { plugin = true, n = { ["s"] = { "(leap-forward)", "leap forward", }, ["S"] = { "(leap-backward)", "leap backward", }, ["gs"] = { "(leap-from-window)", "leap from window", }, }, x = { ["s"] = { "(leap-forward)", "leap forward", }, ["S"] = { "(leap-backward)", "leap forward", }, ["gs"] = { "(leap-from-window)", "leap from window", }, }, o = { ["s"] = { "(leap-forward)", "leap forward", }, ["S"] = { "(leap-backward)", "leap forward", }, ["gs"] = { "(leap-from-window)", "leap from window", }, }, } M.lazygit = { plugin = true, n = { ["gg"] = { " LazyGit ", "Open LazyGit" }, }, } M.lspconfig = { plugin = true, n = { ["[d"] = { function() vim.diagnostic.goto_prev { float = { border = "rounded" } } end, "Goto prev", }, ["]d"] = { function() vim.diagnostic.goto_next { float = { border = "rounded" } } end, "Goto next", }, ["cr"] = { function() require("nvchad.renamer").open() end, "LSP rename", }, }, } M.clipboard = { plugin = false, n = { ["y"] = { '"+y', "yank to system" }, ["Y"] = { '"+Y', "yank to system" }, ["yy"] = { '"+y', "yank to system" }, }, v = { ["y"] = { '"+y', "yank to system" }, ["Y"] = { '"+Y', "yank to system" }, ["yy"] = { '"+y', "yank to system" }, }, } M.telescope = { plugin = true, n = { -- find ["ff"] = { " Telescope find_files ", "Find files" }, ["fa"] = { " Telescope find_files follow=true no_ignore=true hidden=true ", "Find all" }, ["fw"] = { " Telescope live_grep ", "Live grep" }, ["fb"] = { " Telescope buffers ", "Find buffers" }, ["fh"] = { " Telescope help_tags ", "Help page" }, ["fo"] = { " Telescope oldfiles ", "Find oldfiles" }, ["fz"] = { " Telescope current_buffer_fuzzy_find ", "Find in current buffer" }, -- directory ["cd"] = { " Telescope zoxide list", "telescope zoxide cd" }, -- git ["cm"] = { " Telescope git_commits ", "Git commits" }, ["gt"] = { " Telescope git_status ", "Git status" }, -- pick a hidden term ["pt"] = { " Telescope terms ", "Pick hidden term" }, -- theme switcher ["th"] = { " Telescope themes ", "Nvchad themes" }, ["ma"] = { " Telescope marks ", "telescope bookmarks" }, -- lsp stuff ["cw"] = { " Telescope lsp_dynamic_workspace_symbols ", "telescope dynamic workspace symbols" }, ["cf"] = { " Telescope lsp_document_symbols ", "telescope document symbols" }, ["ci"] = { " Telescope diagnostics ", "telescope diagnostics" }, }, } M.toggleterm = { plugin = true, n = { [""] = { 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=tab"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=horizontal"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=vertical"', "toggle terminal", }, }, i = { [""] = { 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=tab"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=horizontal"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=vertical"', "toggle terminal", }, }, t = { [""] = { 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=tab"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=horizontal"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=vertical"', "toggle terminal", }, }, x = { [""] = { 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=float"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=tab"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=horizontal"', "toggle terminal", }, [""] = { 'exe v:count1 "ToggleTerm direction=vertical"', "toggle terminal", }, }, } M.nvimtree = { plugin = true, n = { -- toggle [""] = { " NvimTreeToggle ", "Toggle nvimtree" }, [""] = { " NvimTreeToggle ", "Toggle nvimtree" }, ["tf"] = { " NvimTreeToggle ", "Toggle nvimtree" }, -- focus ["e"] = { " NvimTreeFocus ", "Focus nvimtree" }, }, } M.movements = { plugin = false, i = { --big move [""] = { "", "big step down" }, [""] = { "", "big step down" }, -- go to beginning and end [""] = { "", "Beginning of line" }, [""] = { "", "End of line" }, -- navigate within insert mode [""] = { "", "Move left" }, [""] = { "", "Move right" }, [""] = { "", "Move down" }, [""] = { "", "Move up" }, }, n = { --big move [""] = { "", "big step down" }, [""] = { "", "big step down" }, -- go to beginning and end ["H"] = { "", "Beginning of line" }, ["L"] = { "", "End of line" }, -- go to mark with "#" ["#"] = { "'", "go to mark" }, -- spell ["]s"] = { "]s", "go to next spelling mark" }, ["[s"] = { "[s", "go to last spelling mark" }, -- just scroll a line ["zk"] = { "", "scroll up a line" }, ["zj"] = { "", "scroll down a line" }, }, v = { --big move [""] = { "", "big step down" }, [""] = { "", "big step down" }, -- go to beginning and end ["H"] = { "", "Beginning of line" }, ["L"] = { "", "End of line" }, }, t = { [""] = { vim.api.nvim_replace_termcodes("", true, true, true), "Escape terminal mode", }, }, } M.edit = { plugin = false, n = { -- easy newline ["OO"] = { "O", "insert a line above" }, ["oo"] = { "o", "insert a line below" }, -- substitute (change hovered/selection with insert mode) -- normally, this is s, but that is leaps binding now ["s"] = { "s", "replace with insert mode" }, -- split and join lines ["J"] = { "j" }, [""] = { "join", "join lines" }, [""] = { "il", "split line" }, -- do something useful with the arrows [""] = { " move-2", "Move line up" }, [""] = { " move+", "Move line down" }, [""] = { "<<", "Less indentation" }, [""] = { ">>", "More indentation" }, -- format with conform ["ff"] = { function() -- vim.lsp.buf.format() require("conform").format() end, "format buffer", }, -- remove trailing whitespace ["fw"] = { function() require("mini.trailspace").trim() end, "remove whitespace", }, -- spell ["z"] = { "Telescope spell_suggest", "Spell suggest" }, ["z="] = { "Telescope spell_suggest", "Spell suggest" }, }, v = { -- NOTE: I would love to know why these commands work, they seem really -- crazy. [""] = { ":move'<-2gv=gv", "Move lines up", opts = { silent = true } }, [""] = { ":move'>+gv=gv", "Move lines down", opts = { silent = true } }, [""] = { ""] = { ">gv", "More indentation" }, }, x = {}, t = { --big move [""] = { "", "big step down" }, [""] = { "", "big step down" }, }, } M.ui = { plugin = false, n = { -- toggle wrap ["tw"] = { function() vim.opt_local.wrap = not vim.wo.wrap vim.opt_local.breakindent = not vim.wo.breakindent if vim.wo.colorcolumn == "" then vim.opt_local.colorcolumn = tostring(vim.bo.textwidth) else vim.opt_local.colorcolumn = "" end end, "toggle wrap", }, -- toggle some features ["tn"] = { "setlocal nonumber!", "toggle line numbers" }, ["trn"] = { "setlocal nornu!", "toggle relative line numbers" }, ["ts"] = { "setlocal spell!", "toggle spell check" }, ["ti"] = { function() require("lsp-inlayhints").toggle() end, "toggle inlay hints", }, ["th"] = { function() require("base46").toggle_theme() end, "toggle theme", }, ["te"] = { function() require("base46").toggle_transparency() end, "toggle transparency", }, -- open windows ['"'] = { "vsplit", "open a new window to the side" }, ["%"] = { "split", "open a new window on the totop" }, -- resize windows [""] = { "resize +1", "resize window" }, [""] = { "resize -1", "resize window" }, [""] = { "vertical resize +1", "resize window" }, [""] = { "vertical resize -1", "resize window" }, -- tabs ["wn"] = { "tabnew", "open a new tab" }, ["wc"] = { "tabclose", "close current tab" }, ["wk"] = { "tabnext", "go to next tab" }, ["wj"] = { "tabprevious", "go to prev tab" }, -- folds [""] = { "zMzv", "focus on this fold" }, }, } M.goto_preview = { plugin = true, n = { ["gpd"] = { function() require("goto-preview").goto_preview_definition() end, "go to definition preview", noremap = true, }, ["gpD"] = { function() require("goto-preview").goto_preview_declaration() end, "go to declaration preview", noremap = true, }, ["gpi"] = { function() require("goto-preview").goto_preview_implementation() end, "go to implementation preview", noremap = true, }, ["gpt"] = { function() require("goto-preview").goto_preview_type_definition() end, "go to type preview", noremap = true, }, ["gpr"] = { function() require("goto-preview").goto_preview_type_references() end, "go to references preview", noremap = true, }, ["gpc"] = { function() require("goto-preview").close_all_win() end, "close previews", noremap = true, }, }, } M.debug = { plugin = true, n = { ["db"] = { function() require("dap").toggle_breakpoint() end, "toggle breakpoint", noremap = true, }, ["dc"] = { function() require("dap").continue() end, "debug continue", noremap = true, }, ["ds"] = { function() require("dap").step_over() end, "debug step over", noremap = true, }, ["di"] = { function() require("dap").step_into() end, "debug step into", noremap = true, }, ["dr"] = { function() require("dap").repl.open() end, "debug open repl", noremap = true, }, ["dws"] = { function() local widgets = require "dap.ui.widgets" local my_sidebar = widgets.sidebar(widgets.scopes) my_sidebar.open() end, "debug window scopes", noremap = true, }, ["dwt"] = { function() local widgets = require "dap.ui.widgets" local my_sidebar = widgets.sidebar(widgets.threads) my_sidebar.open() end, "debug window threads", noremap = true, }, ["dwe"] = { function() local widgets = require "dap.ui.widgets" local my_sidebar = widgets.sidebar(widgets.expression) my_sidebar.open() end, "debug window expressions", noremap = true, }, ["dwi"] = { function() local widgets = require "dap.ui.widgets" local my_sidebar = widgets.sidebar(widgets.sessions) my_sidebar.open() end, "debug window sessions", noremap = true, }, ["dwf"] = { function() local widgets = require "dap.ui.widgets" local my_sidebar = widgets.sidebar(widgets.frames) my_sidebar.open() end, "debug window frames", noremap = true, }, ["dK"] = { function() require("dap.ui.widgets").hover() end, "debug hover", noremap = true, }, ["du"] = { function() require("dapui").toggle() end, "debug ui toggle", noremap = true, }, }, } return M