I'm not gonna bother

This commit is contained in:
2025-08-10 13:10:05 -04:00
parent 7c96b43098
commit d320577772
18 changed files with 182 additions and 192 deletions

View File

@ -1,4 +1,7 @@
local map, lz = core.misc.map, core.misc.lz
--- feed keys as userinput
---@param keys string keys
local function feedkeys(keys)
vim.api.nvim_feedkeys(
vim.api.nvim_replace_termcodes(keys, true, false, true),
@ -9,7 +12,8 @@ end
vim.g.mapleader = " " -- set leader key
map("x", "<leader>p", [["_dP]], { desc = "Greatest remap of all time." })
map("n", "<esc>", ":nohlsearch<Bar>:echo<CR>", { desc = "Clear search." })
map("n", "<esc>", "<cmd>noh<Bar>:ec<CR>", { desc = "Clear search." })
map("n", "<leader>a", lz "<cmd>e #<CR>zz", { desc = "swap to alt file" })
-- the cursor STAYS IN THE MIDDLE
map("n", "<S-j>", lz "mzJ`z<cmd>delm z<CR>") -- when combining lines
@ -17,6 +21,8 @@ map("n", "n", lz "nzzzv") -- when searching
map("n", "N", lz "Nzzzv")
map("n", "<C-d>", lz "<C-d>zz") -- half page jumping
map("n", "<C-u>", lz "<C-u>zz")
map("n", "<C-o>", lz "<C-o>zz") -- jump history
map("n", "<C-i>", lz "<C-i>zz")
-- trigger completion menu
-- (stolen from https://gist.github.com/MariaSolOs/2e44a86f569323c478e5a078d0cf98cc)
@ -40,10 +46,20 @@ map("i", "<C-s>", "<C-x><C-s>", { desc = "Trigger spell completion" })
map("n", "<C-s>", lz "<cmd>se spell<CR>ea<C-x><C-s><cmd>se nospell<CR>", { desc = "Trigger spell completion" })
-- quickfix
map("n", "<M-j>", "<cmd>cnext<CR>")
map("n", "<M-k>", "<cmd>cprev<CR>")
map("n", "<M-c>", "<cmd>cclose<CR>")
map("n", "<M-x>", "<cmd>cope<CR>")
map("n", "<M-j>", "<cmd>cnext<CR>", { desc = "qf next" })
map("n", "<M-k>", "<cmd>cprev<CR>", { desc = "qf prev" })
map("n", "<M-c>", "<cmd>cclose<CR>", { desc = "qf close" })
map("n", "<M-x>", "<cmd>cope<CR>", { desc = "qf open" })
-- man pages
map("n", "<C-k>", "<cmd>Man<CR>")
-- okay this is gonna sound crazy, but I like emacs binds for editing when I'm
-- stuck without modal editing like in command mode.
map("c", "<C-a>", function() feedkeys("<Home>") end)
map("c", "<C-e>", function() feedkeys("<End>") end)
map("c", "<C-d>", function() feedkeys("<Del>") end)
-- execute line/block
map("n", "<leader>x", ":.lua<CR>")
map("x", "<leader>x", ":lua<CR>")