-- Keymaps are automatically loaded on the VeryLazy event -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Add any additional keymaps here -- -- Shorten function name local keymap = vim.keymap.set -- Silent keymap option local opts = { silent = true } -- Remap LazyVim keymap("n", "l", "", opts) keymap("n", "lz", ":Lazy", { desc = "Lazy" }) -- Navigate buffers for _, mode in ipairs({ "n", "i", "x" }) do keymap(mode, "", "BufferLineCycleNext", opts) keymap(mode, "", "BufferLineCyclePrev", opts) end keymap("n", "", "", opts) keymap("n", "", "", opts) keymap("n", "", ":BufferLineMoveNext", opts) keymap("n", "", ":BufferLineMovePrev", opts) function go_to_buffer(buffer) return function() require("bufferline").go_to(buffer, true) end end for _, mode in ipairs({ "n", "i", "v" }) do for i = 1, 8 do vim.keymap.set(mode, "", go_to_buffer(i), { noremap = true, silent = true }) end vim.keymap.set(mode, "", go_to_buffer(-1), { noremap = true, silent = true }) end -- Clear highlights keymap("n", "h", "nohlsearch", opts) -- Close buffers keymap("n", "", "Bdelete", opts) keymap("n", "", "Bdelete!", opts) -- search with '-', for my LatinAmerican layout keymap("n", "-", "/", opts) keymap("x", "-", "/", opts) -- disable arrow keys keymap("n", "", "", opts) keymap("n", "", "", opts) keymap("n", "", "", opts) keymap("n", "", "", opts) keymap("i", "", "", opts) keymap("i", "", "", opts) keymap("i", "", "", opts) keymap("i", "", "", opts) local function clean_screen() vim.o.number = not vim.o.number if vim.o.number then if vim.diagnostic.get_next() then pcall(vim.diagnostic.show) end vim.opt.signcolumn = "yes" vim.g.miniindentscope_disable = false MiniIndentscope.draw() vim.cmd("syntax on") vim.cmd("IBLEnable") else MiniIndentscope.undraw() vim.g.miniindentscope_disable = true if vim.diagnostic.get_next() then vim.diagnostic.hide() end vim.opt.signcolumn = "no" vim.cmd("syntax off") vim.cmd("IBLDisable") end end keymap("n", "n", clean_screen, opts) function vim.getVisualSelection() vim.cmd('noau normal! "vy"') local text = vim.fn.getreg("v") vim.fn.setreg("v", {}) text = string.gsub(text, "\n", "") if #text > 0 then return text else return "" end end keymap("n", "ghl", "RepoLink", opts) keymap("x", "ghl", ":RepoLink", opts) keymap("v", "sw", function() local tb = require("telescope.builtin") local text = vim.getVisualSelection() tb.live_grep({ default_text = text }) end, opts) keymap("n", "", "5zl") keymap("n", "", "5zh") keymap("i", "", "5zl") keymap("i", "", "5zh") keymap("x", "", "5zl") keymap("x", "", "5zh") keymap("n", "j", vim.diagnostic.goto_next, opts) keymap("n", "k", vim.diagnostic.goto_prev, opts) keymap("n", "", "DapToggleBreakpoint") keymap("n", "", "DapContinue") keymap("n", "", "DapStepOver") keymap("n", "", "DapStepInto") keymap("n", "", "DapStepOut") vim.keymap.set("n", "K", require("noice.lsp").hover, { noremap = true, silent = true }) local function dismiss_notifications() -- require("notify").dismiss({ silent = true, pending = true }) Snacks.notifier.hide() vim.cmd("noh") end vim.keymap.set("n", "", dismiss_notifications, { desc = "Dismiss notifications" })