local telescope = require("telescope.builtin") local wk = require("which-key") local ufo = require("ufo") local nt_api = require("nvim-tree.api") local spider = require("spider") vim.g.mapleader = " " vim.api.nvim_command("nnoremap :m .+1==") vim.api.nvim_command("nnoremap :m .-2==") vim.api.nvim_command("inoremap :m .-2==gi") vim.api.nvim_command("inoremap :m .+1==gi") vim.api.nvim_command("vnoremap :m '>+1gv=gv") vim.api.nvim_command("vnoremap :m '<-2gv=gv") vim.keymap.set("n", "n", nt_api.tree.toggle) vim.keymap.set("n", "", vim.lsp.buf.code_action) vim.keymap.set("n", "K", vim.lsp.buf.hover) vim.keymap.set("n", "F", vim.lsp.buf.format) vim.keymap.set("n", "d", vim.diagnostic.open_float) vim.keymap.set("n", "J", vim.lsp.buf.signature_help) vim.keymap.set("n", "f", telescope.find_files) vim.keymap.set("n", "", telescope.buffers) vim.keymap.set("n", "D", telescope.lsp_definitions) vim.keymap.set("n", "R", telescope.lsp_references) vim.keymap.set("n", "S", telescope.lsp_document_symbols) vim.keymap.set("n", "U", vim.cmd.UndotreeToggle) vim.keymap.set("n", "m", ":MinimapToggle") vim.keymap.set("n", "b", ":Gitsigns blame_line") vim.keymap.set("n", "h", ":Gitsigns preview_hunk") vim.keymap.set("n", ",", ":TroubleToggle") vim.keymap.set("n", "t", ":belowright split | resize 5 | terminal") vim.keymap.set("n", "[", ufo.openAllFolds) vim.keymap.set("n", "]", ufo.closeAllFolds) vim.keymap.set("n", "r", vim.lsp.buf.rename) vim.keymap.set({ "n"; "o"; "x" }, "W", function() spider.motion("w") end) vim.keymap.set({ "n"; "o"; "x" }, "E", function() spider.motion("e") end) vim.keymap.set({ "n"; "o"; "x" }, "B", function() spider.motion("b") end) vim.keymap.set({ "n"; "o"; "x" }, "gE", function() spider.motion("ge") end) vim.opt.whichwrap = "<,>,h,l,[,]" wk.register({ [""] = "Quick Action"; ["K"] = "Hover"; ["D"] = "Definition"; ["S"] = "Symbols"; ["F"] = "Format"; ["f"] = "Find files"; [""] = "Show buffers"; [","] = "Show errors"; ["["] = "Open folds"; ["]"] = "Close folds"; ["r"] = "Rename"; ["n"] = "Show file tree"; ["m"] = "Toggle Minimap"; ["b"] = "Blame line"; ["h"] = "Preview hunk"; ["d"] = "Show diagnostics"; ["t"] = "Open terminal"; ["s"] = "Save file"; ["q"] = "Quit"; ["R"] = "Show References"; ["J"] = "Signature help"; ["U"] = "Undo tree"; }, { prefix = "" });