local map = vim.keymap.set map("v", "p", function() local val = vim.fn.getreg '+' vim.api.nvim_command [[normal! p]] vim.fn.setreg('+', val) end, { desc = "Special paste, paste without replacing copy register content" }) map("n", "mm", function() local items = vim.fn.systemlist "make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\\/\t=]*:([^=]|$)/ {split($1,A,/ /);print A[1]}'" vim.ui.select(items, { promt = "Make command" }, function(choice) if not choice then return end require("harpoon.term").sendCommand(1, "make " .. choice) end) end) map("n", "bd", ":bd!", { desc = "Deletes the current buffer" }) map("n", "fz", function() vim.cmd [[normal zfaf]] end, { desc = "Fold the function" }) -- lists navigation 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" }) map("n", "tc", ":TSContextToggle", { desc = "Toggle treesitter context" }) -- tabulation 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", { desc = string.format("Add symbol %s to the undo list and writes it", symbol) }) end -- search result focus 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", { desc = "Join lines and keep in the same place the cursor" }) -- Terminal map("t", "", "") map("t", "h", "h") map("t", "j", "j") map("t", "k", "k") map("t", "l", "l") -- quick env file edit map("n", "ee", ":vsp .env", { desc = "Open .env file in a vertical split" }) -- quick save and exec map( "n", "x", require("pi.utils").save_and_exec, { desc = "Save the current file and source it for .vim and .lua files" } ) map( "n", "vn", function() vim.diagnostic.jump({ count = 1, float = true }) end, { desc = "Goes to next diagnostic error" } ) map( "n", "vp", function() vim.diagnostic.jump({ count = -1, float = true }) end, { desc = "Goes to prev diagnostic error" } ) map("v", "q", require('pi.select_to_quickfix').handle) map('n', '99', ':set invspell', { noremap = true }) -- map("n", "ss", function() require('nvim-python-repl').send_statement_definition() end, { desc = "Send semantic unit to REPL"}) vim.api.nvim_set_keymap( 'n', '', [[:lua require('nvim-python-repl').send_statement_definition()j]], {noremap = true, silent = true} ) vim.api.nvim_set_keymap( 'i', '', [[:lua require('nvim-python-repl').send_statement_definition()i]], {noremap = true, silent = true} ) map( "n", "sl", function() require('nvim-python-repl').send_visual_to_repl() end, { desc = "Send visual selection to REPL"} ) map( "v", "sl", function() require('nvim-python-repl').send_visual_to_repl() end, { desc = "Send visual selection to REPL"} ) map( "n", "MReturn", function() require('nvim-python-repl').send_buffer_to_repl() end, { desc = "Send entire buffer to REPL"} ) map( "n", "e", function() require('nvim-python-repl').toggle_execute() end, { desc = "Automatically execute command in REPL after sent"} ) map( "n", "vi", function() require('nvim-python-repl').toggle_vertical() end, { desc = "Create REPL in vertical or horizontal split"} ) map( "n", "-", "Oil", { desc = "Open parent directory" } ) map( "n", "fg", function() require('telescope').extensions.live_grep_args.live_grep_args() end, {desc = "run grep"} ) -- Asignar la función a una tecla específica vim.api.nvim_set_keymap( 'n', 'w', ':lua ToggleWrap()', { noremap = true, silent = true } ) vim.keymap.set ( "n", "rrn", ':RustLsp runnables', {desc = "run rust"} )