vim.g.mapleader = " " vim.g.maplocalleader = " " local wk = require("which-key") local keys = { a = {"Copilot suggestion accept", "Copilot"}, e = { name = "Toggle", e = {"NeoTreeFloatToggle", "NeoTree"}, w = {vim.cmd.Ex, "netrw"}, l = { name = "LSP", k = {"LspStop", "Stop"}, s = {"LspStart", "Start"}, }, g = {"NeoTreeFloatToggle git_status", "Git Status"}, b = {"NeoTreeFloatToggle buffers", "Buffers"}, c = {"NeoTreeClose" , "Close"}, s = {"Navbuddy" , "Symbols"}, o = {function () require("oil").open_float(vim.fn.getcwd()) end, "Oil"}, }, c = { name = "LSP", S = {"AerialToggle", "Symbol sidebar"}, w = {function () vim.lsp.buf.workspace_symbol("") end, "workspace symbol"}, d = {function () vim.diagnostic.open_float() end, "diagnostic"}, a = {function () vim.lsp.buf.code_action() end, "code actions"}, r = {function () vim.lsp.buf.references() end, "references"}, n = {function () vim.lsp.buf.rename() end, "rename"}, h = {function () vim.lsp.buf.hover() end, "Hover"}, t = {function () vim.lsp.buf.type_definition() end,"Type Definition"}, s = {"Navbuddy", "Navbuddy"}, -- s = {require("telescope.builtin").lsp_document_symbols, "Document Symbols"}, o = { name = "Copilot", a = {"Copilot suggestion accept", "Accept"}, w = {"Copilot suggestion accept_word", "Word"}, l = {"Copilot suggestion accept_line", "Line"}, d = {"Copilot suggestion dismiss", "Decline"}, n = {"Copilot suggestion next", "Next"}, p = {"Copilot suggestion prev", "Previous"}, t = {"Copilot suggestion toggle_auto_trigger", "toggle"}, P = { name = "Panel", t = {"Copilot panel open", "Open"}, r = {"Copilot panel refresg", "Refresh"}, n = {"Copilot panel jump_next", "Next"}, p = {"Copilot panel jump_prev", "Previous"}, a = {"Copilot panel accept", "Accept"}, }, }, g = { name = "Goto Preview", d = {function () require('goto-preview').goto_preview_definition() end, "Definition"}, r = {function () require('goto-preview').goto_preview_references() end, "References"}, t = {function () require("goto-preview").goto_preview_type_definitions() end, "Type"}, i = {function () require("goto-preview").goto_preview_implementation() end, "Implementation"}, c = {function () require("goto-preview").close_all_win() end, "Close"}, }, }, q = { name = "Nvim", q = {"q", "Quit"}, W = {"wq", "Save and Quit"}, w = {"w", "Save"}, }, u = {"vim.cmd.UndotreeToggle", "UndoTree"}, b = { name = "Buffer", h = {vim.cmd.bprevious, "Previous"}, l = {vim.cmd.bnext, "Next"}, H = {vim.cmd.bfirst, "First"}, L = {vim.cmd.blast, "Last"}, b = {require("telescope.builtin").buffers, "Picker"}, c = {":bp | sp | bn | bd", "Close"}, }, f = { name = "Telescope & fzf", c = {require("telescope.builtin").colorscheme, "Find Colorscheme"}, d = {require("telescope.builtin").diagnostics, "Find Diagnostics"}, w = {require("telescope.builtin").grep_string, "Find current Word"}, f = {require("telescope.builtin").find_files, "telescope find files"}, g = {require("telescope.builtin").live_grep, "live grep"}, b = {require("telescope.builtin").buffers, "buffers"}, h = {require("telescope.builtin").help_tags, "help tags"}, s = {function () require("telescope.builtin").grep_string({ search = vim.fn.input("Grep > ")}); end, "grep search through files"}, p = {"Telescope projects", "Projects"}, }, s = { name = "Settings", c = {function () vim.opt.scrolloff = 100 end, "Always center cursor"}, x = {function () vim.opt.scrolloff = 8 end, "Disable Cursor center"}, f = {function () vim.opt.nu = true vim.opt.relativenumber = true end, "Fix number and relative numbers"}, m = {function () vim.cmd[[ highlight CursorColumn guibg=none ctermbg=none highlight link CursorColumn CursorLine ]] end, "Fix cursor highlight"}, }, h = { name = "Hop", w = {"HopWord", "Word"}, a = {"HopAnywhere", "Anywhere"}, l = {"HopLine", "Line"}, p = {"HopPattern", "Pattern"}, c = {"HopChar1", "Char1"}, x = {"HopChar2", "Char2"}, h = {vim.cmd.HopChar2, "Hop"}, }, d = { name = "Debug", b = {function () require("dap").toggle_breakpoint() end, "toggle breakpoint"}, c = {function () require("dap").continue() end, "launch or continue execution"}, s = {function () require("dap").step_into() end, "step into"}, o = {function () require("dap").step_over() end, "step over"}, r = {function () require("dap").repl.open() end, "open repl"}, w = { name = "Debug UI", b = {function () require("dapui").float_element("breakpoints", {}) end, "open breakpoints window"}, c = {function () require("dapui").float_element("console", {}) end, "open integrated console"}, r = {function () require("dapui").float_element("repl", {}) end, "open repl"}, } }, w = { name = "workspace", a = {vim.lsp.buf.add_workspace_folder, "add folder"}, r = {vim.lsp.buf.remove_workspace_folder, "remove folder"}, l = {function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, "list folders"}, }, } wk.register(keys, {prefix = ""}) wk.register(keys, {prefix = ""}) wk.register(keys, {prefix = "", mode = "i"}) wk.register(keys, {prefix = "", mode = "v"}) -- LSP vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, {desc = "goto definition"}) vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, {}) vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, {desc = "goto next"}) vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, {desc = "goto prev"}) vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end) vim.keymap.set("i", "", function () vim.lsp.buf.hover() end, {}) -- term vim.keymap.set("n", "", vim.cmd.ToggleTerm) vim.keymap.set("t", "", vim.cmd.ToggleTerm) -- center vim.keymap.set("n", "", "zz") vim.keymap.set("n", "", "zz") vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") -- visual move vim.keymap.set("x", "K", ":move '<-2gv=gv") vim.keymap.set("x", "J", ":move '>+1gv=gv") -- me lazy vim.keymap.set("i", "", "") -- non char keybinds vim.keymap.set("n", "f/", function () require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown { winblend = 10, previewer = false, }) end, {desc = "fuzzy find"}) vim.keymap.set('n', 'f?', require('telescope.builtin').oldfiles, { desc = 'Find recently opened files' }) vim.keymap.set("i", "f/", function () require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown { winblend = 10, previewer = false, }) end, {desc = "fuzzy find"}) vim.keymap.set('i', 'f?', require('telescope.builtin').oldfiles, { desc = 'Find recently opened files' })