-- Non-exhaustive collection of keymaps. I've decided it's more sane to place -- plugin specific maps in their respective setup scripts vim.g.mapleader = " " vim.keymap.set("n", "", "") vim.keymap.set("t", "", "") vim.keymap.set("n", "", "zz") vim.keymap.set("n", "", "zz") vim.keymap.set("n", "mr", function() vim.cmd.CellularAutomaton("make_it_rain") end) vim.keymap.set("n", "bruh", function() vim.cmd.CellularAutomaton("game_of_life") end) -- when searching, also center screen and reopen folds vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") -- The greatest remap of all time -- the primeagen vim.keymap.set({ "n", "v" }, "d", '"_d', { desc = "same as `d` but send to black hole register" }) vim.keymap.set({ "n", "v" }, "D", '"_D', { desc = "same as `D` but send to black hole register" }) -- The real greatest remap(s) of all time -- me vim.keymap.set({ "n", "v" }, "y", '"+y', { desc = "yank to clipboard" }) vim.keymap.set({ "n", "v" }, "Y", '"+Y', { desc = "yank rest of line to clipboard" }) vim.keymap.set({ "n", "v" }, "p", '"+p', { desc = "put after cursor from clipboard" }) vim.keymap.set({ "n", "v" }, "P", '"+P', { desc = "put before cursor from clipboard" }) vim.keymap.set("n", "gg", function() vim.cmd.Neogit() end, { desc = "Open neogit" }) vim.keymap.set("n", "gc", function() vim.cmd.Neogit("kind=floating commit") end, { desc = "Open neogit commit menu" }) vim.keymap.set("n", "u", function() vim.cmd.UndotreeToggle() end, { desc = "Toggle undotree" }) vim.keymap.set({ "n", "v" }, "cf", function() require("conform").format({ async = true }) end) vim.keymap.set({ "n", "v" }, "ctf", function() if vim.g.disable_autoformat then vim.g.disable_autoformat = false else vim.g.disable_autoformat = true end end, { desc = "Disable autoformat on save globally" }) vim.keymap.set({ "n", "v" }, "cbf", function() if vim.b[0].disable_autoformat then vim.b[0].disable_autoformat = false else vim.b[0].disable_autoformat = true end end, { desc = "Disable autoformat on save buffer" })