From 08d5556ab2f104cc2daff59c078c12816b8c9acc Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Mon, 10 Apr 2023 10:18:01 +0200 Subject: feat(general): update keymaps --- lua/config/keymaps.lua | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'lua/config/keymaps.lua') diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index ae03444..39831ed 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -4,36 +4,33 @@ map("v", "p", function() local val = vim.fn.getreg '"' vim.api.nvim_command [[normal! p]] vim.fn.setreg('"', val) -end) +end, { desc = "Special paste, paste without replacing copy register content" }) -map("n", "bd", ":bd!") +map("n", "bd", ":bd!", { desc = "Deletes the current buffer" }) -- lists navigation -map("n", "j", ":cnextzz") -map("n", "k", ":cprevzz") -map("n", "i", ":lnextzz") -map("n", "o", ":lprevzz") -map("n", "cc", ":cclose") - --- quick split -map("n", "wsv", ":vsp") +map("n", "", ":cnextzz", { desc = "Goes to the next item in the quickfixlist and center to the screen" }) +map("n", "", ":cprevzz", { desc = "Goes to the previous item in the quickfixlist and center to the screen" }) +-- map("n", "i", ":lnextzz") +-- map("n", "o", ":lprevzz") +map("n", "cc", ":cclose", { desc = "Close the quick fix list" }) -- tabulation -map("v", "<", "", ">gv") +map("v", "<", "", ">gv", { desc = "Indent in and keeps the selection" }) -- symbols to add undo points local symbols = { ",", ".", "!", "?", "$", ">", "<" } for _, symbol in pairs(symbols) do - map("i", symbol, symbol .. "u") + map("i", symbol, symbol .. "u", { desc = string.format("Add symbol %s to the undo list and writes it", symbol) }) end -- search result focus -map("n", "n", "nzzzv") -map("n", "N", "Nzzzv") +map("n", "n", "nzzzv", { desc = "Goes to next result on the search and put the cursor in the middle of the screen" }) +map("n", "N", "Nzzzv", { desc = "Goes to prev result on the search and put the cursor in the middle of the screen" }) -- join lines focus -map("n", "J", "mzJ`z") +map("n", "J", "mzJ`z", { desc = "Join lines and keep in the same place the cursor" }) -- Terminal map("t", "", "") @@ -43,10 +40,15 @@ map("t", "k", "k") map("t", "l", "l") -- quick env file edit -map("n", "ee", ":vsp .env") +map("n", "ee", ":vsp .env", { desc = "Open .env file in a vertical split" }) -- quick save and exec -map("n", "x", require("alpha.utils").save_and_exec) - -map("n", "vn", vim.diagnostic.goto_next, {}) -map("n", "vp", vim.diagnostic.goto_prev, {}) +map( + "n", + "x", + require("alpha.utils").save_and_exec, + { desc = "Save the current file and source it for .vim and .lua files" } +) + +map("n", "vn", vim.diagnostic.goto_next, { desc = "Goes to next diagnostic error" }) +map("n", "vp", vim.diagnostic.goto_prev, { desc = "Goes to prev diagnostic error" }) -- cgit v1.2.3