diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-04-10 10:18:01 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-04-10 10:18:01 +0200 |
| commit | 08d5556ab2f104cc2daff59c078c12816b8c9acc (patch) | |
| tree | 2e72e8d8e555d92195ae7e1d9f34c732f5be7886 /lua/config/keymaps.lua | |
| parent | 11fa125e9ed415021a2c5223e396c8f73fa05a13 (diff) | |
| download | nvim-conf-08d5556ab2f104cc2daff59c078c12816b8c9acc.tar.gz nvim-conf-08d5556ab2f104cc2daff59c078c12816b8c9acc.zip | |
feat(general): update keymaps
Diffstat (limited to 'lua/config/keymaps.lua')
| -rw-r--r-- | lua/config/keymaps.lua | 44 |
1 files changed, 23 insertions, 21 deletions
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", "<leader>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", "<leader>bd", ":bd!<CR>") +map("n", "<leader>bd", ":bd!<CR>", { desc = "Deletes the current buffer" }) -- lists navigation -map("n", "<leader>j", ":cnext<CR>zz") -map("n", "<leader>k", ":cprev<CR>zz") -map("n", "<leader>i", ":lnext<CR>zz") -map("n", "<leader>o", ":lprev<CR>zz") -map("n", "<leader>cc", ":cclose<CR>") - --- quick split -map("n", "<leader>wsv", ":vsp<CR>") +map("n", "<C-j>", ":cnext<CR>zz", { desc = "Goes to the next item in the quickfixlist and center to the screen" }) +map("n", "<C-k>", ":cprev<CR>zz", { desc = "Goes to the previous item in the quickfixlist and center to the screen" }) +-- map("n", "<leader>i", ":lnext<CR>zz") +-- map("n", "<leader>o", ":lprev<CR>zz") +map("n", "<leader>cc", ":cclose<CR>", { desc = "Close the quick fix list" }) -- tabulation -map("v", "<", "<gv") -map("v", ">", ">gv") +map("v", "<", "<gv", { desc = "Indent out and keeps the selection" }) +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 .. "<c-g>u") + map("i", symbol, symbol .. "<c-g>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", "<Esc><Esc>", "<C-\\><C-n>") @@ -43,10 +40,15 @@ map("t", "<C-w>k", "<C-\\><C-n><C-w>k") map("t", "<C-w>l", "<C-\\><C-n><C-w>l") -- quick env file edit -map("n", "<leader>ee", ":vsp .env<CR>") +map("n", "<leader>ee", ":vsp .env<CR>", { desc = "Open .env file in a vertical split" }) -- quick save and exec -map("n", "<leader><leader>x", require("alpha.utils").save_and_exec) - -map("n", "<leader>vn", vim.diagnostic.goto_next, {}) -map("n", "<leader>vp", vim.diagnostic.goto_prev, {}) +map( + "n", + "<leader><leader>x", + require("alpha.utils").save_and_exec, + { desc = "Save the current file and source it for .vim and .lua files" } +) + +map("n", "<leader>vn", vim.diagnostic.goto_next, { desc = "Goes to next diagnostic error" }) +map("n", "<leader>vp", vim.diagnostic.goto_prev, { desc = "Goes to prev diagnostic error" }) |