---@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" }, -- 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" }, }, } M.toggleterm = { plugin = true, n = { [""] = { "ToggleTerm direction=float", "toggle terminal", }, [""] = { "ToggleTerm direction=float", "toggle terminal", }, [""] = { "ToggleTerm direction=tab", "toggle terminal", }, [""] = { "ToggleTerm direction=horizontal", "toggle terminal", }, [""] = { "ToggleTerm direction=vertical", "toggle terminal", }, }, t = { [""] = { "ToggleTerm direction=float", "toggle terminal", }, [""] = { "ToggleTerm direction=float", "toggle terminal", }, [""] = { "ToggleTerm direction=tab", "toggle terminal", }, [""] = { "ToggleTerm direction=horizontal", "toggle terminal", }, [""] = { "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" }, }, 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 [""] = { "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() 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, }, }, } return M