-- 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 local map = vim.keymap.set local Util = require("lazyvim.util") -- Search current word -- stylua: ignore local searching_brave = [[:lua vim.fn.system({'xdg-open', 'https://search.brave.com/search?q=' .. vim.fn.expand("")})]] map("n", "?", searching_brave, { noremap = true, silent = true, desc = "Search current word on brave search" }) -- Toggle background -- stylua: ignore map("n", "uB", function() Util.toggle("background", false, { "light", "dark" }) end, { desc = "Toggle Background" }) -- Disable lazyterminal keymap map("n", "fT", "") -- End of the word backwards map("n", "E", "ge") -- Increment/decrement map("n", "+", "") map("n", "-", "") -- Tabs map("n", "]", "tabnext", { desc = "Next Tab" }) map("n", "[", "tabprevious", { desc = "Previous Tab" }) map("n", "1", "tabn 1", { desc = "Tab 1" }) map("n", "2", "tabn 2", { desc = "Tab 2" }) map("n", "3", "tabn 3", { desc = "Tab 3" }) map("n", "4", "tabn 4", { desc = "Tab 4" }) map("n", "5", "tabn 5", { desc = "Tab 5" }) map("n", "6", "tabn 6", { desc = "Tab 6" }) map("n", "7", "tabn 7", { desc = "Tab 7" }) map("n", "8", "tabn 8", { desc = "Tab 8" }) map("n", "9", "tabn 9", { desc = "Tab 9" }) -- Buffers map("n", "bf", "bfirst", { desc = "First Buffer" }) map("n", "ba", "blast", { desc = "Last Buffer" }) -- Center the screen automatically map("n", "n", "nzzzv") map("n", "N", "Nzzzv") -- Toggle statusline map("n", "uS", function() if vim.opt.laststatus:get() == 0 then vim.opt.laststatus = 3 else vim.opt.laststatus = 0 end end, { desc = "Toggle Statusline" }) -- Plugin Info map("n", "cif", "LazyFormatInfo", { desc = "Formatting" }) map("n", "cic", "ConformInfo", { desc = "Conform" }) map("n", "cir", "LazyRoot", { desc = "Root" }) map("n", "cie", "LazyExtras", { desc = "Extras" }) -- U for redo map("n", "U", "", { desc = "Redo" }) -- Move to beginning/end of line map("n", "", "_", { desc = "First character of Line" }) map("n", "", "$", { desc = "Last character of Line" }) -- Copy whole text to clipboard map("n", "", ":%y+", { desc = "Copy whole text to clipboard", silent = true }) -- Motion map("c", "", "", { desc = "Start Of Line" }) map("i", "", "", { desc = "Start Of Line" }) map("i", "", "", { desc = "End Of Line" }) -- Select all text map("n", "", "ggG", { desc = "Select all text", silent = true, noremap = true }) -- Paste options map("i", "", '"', { desc = "Paste on insert mode" }) map("v", "p", '"_dP', { desc = "Paste without overwriting" }) -- Delete and change without yanking map({ "n", "x" }, "", '"_d', { desc = "Delete without yanking" }) map({ "n", "x" }, "", '"_c', { desc = "Change without yanking" }) -- Deleting without yanking empty line map("n", "dd", function() local is_empty_line = vim.api.nvim_get_current_line():match("^%s*$") if is_empty_line then return '"_dd' else return "dd" end end, { noremap = true, expr = true, desc = "Don't yank empty line to clipboard" }) -- Search inside visually highlighted text. Use `silent = false` for it to -- make effect immediately. map("x", "g/", "/\\%V", { silent = false, desc = "Search inside visual selection" }) -- Search visually selected text (slightly better than builtins in Neovim>=0.8) map("x", "*", [[y/\V=escape(@", '/\')]]) map("x", "#", [[y?\V=escape(@", '?\')]])