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", "ch", "NvCheatsheet", { desc = "toggle nvcheatsheet" }) 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" }) -- tabufline if require("nvconfig").ui.tabufline.enabled then map("n", "b", "enew", { desc = "buffer new" }) map("n", "", function() require("nvchad.tabufline").next() end, { desc = "buffer goto next" }) map("n", "", function() require("nvchad.tabufline").prev() end, { desc = "buffer goto prev" }) map("n", "x", function() require("nvchad.tabufline").close_buffer() end, { desc = "buffer close" }) end -- Comment map("n", "/", "gcc", { desc = "toggle comment", remap = true }) map("v", "/", "gc", { desc = "toggle comment", remap = true }) -- nvimtree map("n", "", "NvimTreeToggle", { desc = "nvimtree toggle window" }) map("n", "e", "NvimTreeFocus", { desc = "nvimtree focus window" }) -- telescope -- map("n", "fw", "Telescope live_grep", { desc = "telescope live grep" }) -- map("n", "fb", "Telescope buffers", { desc = "telescope find buffers" }) -- map("n", "fh", "Telescope help_tags", { desc = "telescope help page" }) -- map("n", "ma", "Telescope marks", { desc = "telescope find marks" }) -- map("n", "fo", "Telescope oldfiles", { desc = "telescope find oldfiles" }) -- map("n", "fz", "Telescope current_buffer_fuzzy_find", { desc = "telescope find in current buffer" }) -- map("n", "cm", "Telescope git_commits", { desc = "telescope git commits" }) -- map("n", "gt", "Telescope git_status", { desc = "telescope git status" }) -- map("n", "pt", "Telescope terms", { desc = "telescope pick hidden term" }) -- -- map("n", "th", function() -- require("nvchad.themes").open() -- end, { desc = "telescope nvchad themes" }) -- -- map("n", "ff", "Telescope find_files", { desc = "telescope find files" }) -- map( -- "n", -- "fa", -- "Telescope find_files follow=true no_ignore=true hidden=true", -- { desc = "telescope find all files" } -- ) -- terminal map("t", "", "", { desc = "terminal escape terminal mode" }) -- new terminals map("n", "h", function() require("nvchad.term").new { pos = "sp" } end, { desc = "terminal new horizontal term" }) map("n", "v", function() require("nvchad.term").new { pos = "vsp" } end, { desc = "terminal new vertical term" }) -- toggleable map({ "n", "t" }, "", function() require("nvchad.term").toggle { pos = "vsp", id = "vtoggleTerm" } end, { desc = "terminal toggleable vertical term" }) map({ "n", "t" }, "", function() require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm" } end, { desc = "terminal toggleable horizontal term" }) map({ "n", "t" }, "", function() require("nvchad.term").toggle { pos = "float", id = "floatTerm" } end, { desc = "terminal toggle floating term" }) -- 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" })