local map = vim.keymap.set -- General map("n", ";", ":", { desc = "General Enter command mode" }) map("n", "", "noh", { desc = "General Clear highlights" }) map("n", "ch", "NvCheatsheet", { desc = "General Toggle nvcheatsheet" }) -- File map("n", "", "w", { desc = "File Save" }) map("n", "f", function() require("conform").format({ lsp_fallback = true }) end, { desc = "File Format" }) -- Buffer 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" }) -- nvimtree map("n", "pv", "NvimTreeToggle", { desc = "nvimtree toggle window" }) -- Terminal map("t", "", "", { desc = "Terminal Escape terminal mode" }) map("n", "h", function() require("nvchad.term").new { pos = "sp" } end, { desc = "Terminal New horizontal term" }) map({ "n", "t" }, "", function() require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm" } end, { desc = "Terminal New horizontal term" }) map({ "n", "t" }, "", function() require("nvchad.term").toggle { pos = "float", id = "floatTerm" } end, { desc = "Terminal Toggle floating term" }) -- Vertical map("n", "", "zz", { desc = "Vertical Scroll down and keep cursor in same position" }) map("n", "", "zz", { desc = "Vertical Scroll up and keep cursor in same position" }) -- Find/Replace map("n", "n", "nzzzv", { desc = "Find/Replace Move to next match" }) map("n", "N", "Nzzzv", { desc = "Find/Replace Move to previous match" }) map("n", "s", [[:%s/\<\>//gI]], { desc = "Find/Replace Replace current word" }) -- Editing map("v", "J", ":m '>+1gv=gv", { desc = "Editing Move line down" }) map("v", "K", ":m '<-2gv=gv", { desc = "Editing Move line up" }) map("n", "Y", [["+Y]], { desc = "Editing Copy line to system clipboard" }) map("v", "p", [["_dP]], { desc = "Editing Replace text with paste buffer" }) map({ "n", "v" }, "y", [["+y]], { desc = "Editing Copy to system clipboard" }) map({ "n", "v" }, "d", [["_d]], { desc = "Editing Delete selected to void buffer" }) -- Navigation map("n", "", "cnextzz", { desc = "Navigation Move to next in quickfix list" }) map("n", "", "cprevzz", { desc = "Navigation Move to previous in quickfix list" }) map("n", "k", "lnextzz", { desc = "Navigation Move to next in location list" }) map("n", "j", "lprevzz", { desc = "Navigation Move to previous in location list" }) -- Telescope map("n", "pf", "Telescope find_files", { desc = "Telescope Find files" }) map("n", "pa", "Telescope find_files follow=true no_ignore=true hidden=true", { desc = "Telescope Find all files" }) map("n", "ps", "Telescope live_grep", { desc = "Telescope Live grep" }) map("n", "pz", "Telescope current_buffer_fuzzy_find", { desc = "Telescope Find in current buffer" }) map("n", "pws", function() local word = vim.fn.expand("") require('telescope.builtin').grep_string({ search = word }) end, { desc = "Telescope Search for current word" }) map("n", "pWs", function() local word = vim.fn.expand("") require('telescope.builtin').grep_string({ search = word }) end, { desc = "Telescope Search for current WORD" }) map("n", "ws", function() require('telescope.builtin').lsp_document_symbols({ ignore_symbols = 'variable' }) end, { desc = "Telescope View workspace symbols" }) -- Undotree map("n", "u", "UndotreeToggle", { desc = "Undotree Toggle window Open diagnostics" }) -- Trouble map("n", "tt", "Trouble diagnostics toggle", { desc = "Errors Open diagnostics" }) map("n", "tf", "Trouble diagnostics toggle filter.buf=0", { desc = "Errors Open buffer diagnostics" }) map("n", "tl", "Trouble loclist toggle", { desc = "Errors Open location list" }) map("n", "tq", "Trouble qflist toggle", { desc = "Errors Open quickfix fist" }) -- ZenMode map("n", "zz", "ZenMode", { desc = "ZenMode Toggle window" })