local map = vim.keymap.set map("i", "", "^i", { desc = "move beginning of line" }) map("i", "", "", { desc = "move end of line" }) map("i", "", "", { desc = "move left" }) map("i", "", "", { desc = "move right" }) map("i", "", "", { desc = "move down" }) map("i", "", "", { desc = "move up" }) map("n", "", "h", { desc = "switch window left" }) map("n", "", "l", { desc = "switch window right" }) map("n", "", "j", { desc = "switch window down" }) map("n", "", "k", { desc = "switch window up" }) map("n", "", "noh", { desc = "general clear highlights" }) map("n", "", "w", { desc = "general save file" }) map("n", "", "%y+", { desc = "general copy whole file" }) map("n", "n", "set nu!", { desc = "toggle line number" }) map("n", "rn", "set rnu!", { desc = "toggle relative number" }) map({ "n", "x" }, "fm", function() require("conform").format { lsp_fallback = true } end, { desc = "general format file" }) -- global lsp mappings map("n", "ds", vim.diagnostic.setloclist, { desc = "LSP diagnostic loclist" }) -- Comment map("n", "/", "gcc", { desc = "toggle comment", remap = true }) map("v", "/", "gc", { desc = "toggle comment", remap = true }) -- terminal map("t", "", "", { desc = "terminal escape terminal mode" }) -- whichkey map("n", "wK", "WhichKey ", { desc = "whichkey all keymaps" }) map("n", "wk", function() vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ") end, { desc = "whichkey query lookup" }) map('v', '', '"+ygv"*ygv', { noremap = true }) map('v', '<2-LeftRelease>', '"+ygv"*ygv', { noremap = true })