-- Shorten function name local keymap = vim.keymap.set -- Silent keymap option local opts = { silent = true } --Remap space as leader key keymap("", "", "", opts) vim.g.mapleader = " " -- Modes -- normal_mode = "n", -- insert_mode = "i", -- visual_mode = "v", -- visual_block_mode = "x", -- term_mode = "t", -- command_mode = "c", -- Normal -- -- Better window navigation keymap("n", "", "h", opts) keymap("n", "", "j", opts) keymap("n", "", "k", opts) keymap("n", "", "l", opts) -- Resize with arrows keymap("n", "", ":resize -2", opts) keymap("n", "", ":resize +2", opts) keymap("n", "", ":vertical resize -2", opts) keymap("n", "", ":vertical resize +2", opts) -- Navigate buffers keymap("n", "", ":bnext", opts) keymap("n", "", ":bprevious", opts) for _, mode in ipairs({"n", "i", "v"}) do vim.keymap.set(mode, '', "BufferLineGoToBuffer 1", { noremap = true, silent = true }) vim.keymap.set(mode, '', "BufferLineGoToBuffer 2", { noremap = true, silent = true }) vim.keymap.set(mode, '', "BufferLineGoToBuffer 3", { noremap = true, silent = true }) vim.keymap.set(mode, '', "BufferLineGoToBuffer 4", { noremap = true, silent = true }) vim.keymap.set(mode, '', "BufferLineGoToBuffer 5", { noremap = true, silent = true }) end -- Clear highlights keymap("n", "h", "nohlsearch", opts) -- Close buffers keymap("n", "", "Bdelete", opts) keymap("n", "", "Bdelete!", opts) -- Better paste keymap("v", "p", '"_dP', opts) -- Insert -- -- Press jk fast to enter --keymap("i", "jk", "", opts) -- Visual -- -- Stay in indent mode keymap("v", "<", "", ">gv", opts) -- Plugins -- -- NvimTree keymap("n", "e", ":NvimTreeToggle", opts) -- Telescope keymap("n", "ff", ":Telescope find_files", opts) keymap("n", "ft", ":Telescope live_grep", opts) keymap("n", "fp", ":Telescope projects", opts) keymap("n", "fb", ":Telescope buffers", opts) -- Git --keymap("n", "gg", "lua _LAZYGIT_TOGGLE()", opts) -- Comment keymap("n", "/", "lua require('Comment.api').toggle_current_linewise()", opts) keymap("x", "/", 'lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())') ---- DAP --keymap("n", "", "lua require'dap'.toggle_breakpoint()", opts) --keymap("n", "", "lua require'dap'.continue()", opts) --keymap("n", "", "lua require'dap'.step_over()", opts) --keymap("n", "", "lua require'dap'.step_into()", opts) --keymap("n", "", "lua require'dap'.step_out()", opts) --keymap("n", "dr", "lua require'dap'.repl.toggle()", opts) --keymap("n", "dl", "lua require'dap'.run_last()", opts) --keymap("n", "du", "lua require'dapui'.toggle()", opts) --keymap("n", "", "lua require'dap'.terminate()", opts) -- Vimspector keymap("n", "", "VimspectorToggleBreakpoint", opts) keymap("n", "", "VimspectorContinue", opts) keymap("n", "", "VimspectorStepOver", opts) keymap("n", "", "VimspectorStepInto", opts) keymap("n", "", "VimspectorStepOut", opts) keymap("n", "", "VimspectorReset", opts) -- Shift+F5 keymap("n", "", "VimspectorRestart", opts) -- Ctrl+Shift+F5 keymap("n", "di", "VimspectorBalloonEval", opts) --keymap("n", "dl", "lua require'dap'.run_last()", opts) --keymap("n", "du", "lua require'dapui'.toggle()", opts) --keymap("n", "", "lua require'dap'.terminate()", opts) keymap("n", "bf", vim.lsp.buf.format, opts) -- Shift+F5 keymap("v", "bf", vim.lsp.buf.format, opts) -- Shift+F5