{ globals = { mapleader = " "; }; keymaps = [ { # Unmap space (leader) action = ""; key = ""; options = { noremap = true; silent = true; }; mode = "n"; } { action = "ZenMode"; key = "wz"; options = { silent = true; noremap = true; desc = "Zen mode"; }; } { mode = "n"; action = ":%%s/\\<\\>//gI"; key = "fs"; options = { silent = true; noremap = true; desc = "Search and replace the word under the cursor globally and case-insensitively"; }; } # center the screen when scrolling { mode = "n"; action = ":CellularAutomaton make_it_rain"; key = "kys"; options = { silent = true; noremap = true; desc = "A mysterious surprise!"; }; } { mode = "n"; action = "nzzzv"; key = "n"; options = { silent = true; noremap = true; desc = "Search next and center screen, reopening folds"; }; } { mode = "n"; action = "Nzzzv"; key = "N"; options = { silent = true; noremap = true; desc = "Search previous and center screen, reopening folds"; }; } # The greatest remap of all time -- the primeagen { mode = [ "n" "v" ]; action = "\"_d"; key = "d"; options = { silent = true; noremap = true; desc = "Delete without copying to register"; }; } { mode = [ "n" "v" ]; action = "\"+y"; key = "y"; options = { silent = true; noremap = true; desc = "Yank to system clipboard"; }; } { mode = "n"; action = "\"+Y"; key = "Y"; options = { silent = true; noremap = true; desc = "Yank whole line to system clipboard"; }; } { mode = [ "n" "v" ]; action = "\"+p"; key = "p"; options = { silent = true; noremap = true; desc = "Put from system clipboard"; }; } { mode = [ "n" "v" ]; action = "\"+P"; key = "P"; options = { silent = true; noremap = true; desc = "Put from system clipboard"; }; } { action = "Telescope find_files"; key = "ff"; options = { silent = true; noremap = true; desc = "Find files"; }; } { action = "Telescope live_grep"; key = "/"; options = { silent = true; noremap = true; desc = "Live grep"; }; } { action = "Telescope buffers"; key = "fb"; options = { silent = true; noremap = true; desc = "List buffers"; }; } { action = "Telescope help_tags"; key = "fh"; options = { silent = true; noremap = true; desc = "Help tags"; }; } { action = "lua require'telescope.builtin'.lsp_definitions{}"; key = "gd"; options = { silent = true; noremap = true; desc = "Go to definition, or search through them (if multiple)"; }; } { action = "lua require'telescope.builtin'.lsp_implementations{}"; key = "gr"; options = { silent = true; noremap = true; desc = "Go to implementation"; }; } { action = "lua require'telescope.builtin'.lsp_workplace_symbols{}"; key = "fs"; options = { silent = true; noremap = true; desc = "List and search through document symbols"; }; } { action = "lua require'telescope.builtin'.lsp_type_definitions{}"; key = "fct"; options = { silent = true; noremap = true; desc = "List and search through type definitions"; }; } { action = "lua require'telescope.builtin'.lsp_references{}"; key = "fcr"; options = { silent = true; noremap = true; desc = "List and search through references"; }; } { action = "lua require'telescope.builtin'.diagnostics{}"; key = "fcd"; options = { silent = true; noremap = true; desc = "List and search through diagnostics"; }; } { action = "lua require'telescope.builtin'.keymaps{}"; key = "fcd"; options = { silent = true; noremap = true; desc = "Search through keymaps"; }; } { action = "lua require'telescope.builtin'.git_files{}"; key = " "; options = { silent = true; noremap = true; desc = "List Git files"; }; } { action = "lua require'telescope.builtin'.find_files{}"; key = "ff"; options = { silent = true; noremap = true; desc = "List all files"; }; } { action = ""; key = ""; options = { silent = true; noremap = true; desc = "Go to normal mode in built-in terminal."; }; mode = "t"; } { action = ":resize +4"; key = "w="; options = { silent = true; noremap = true; desc = "Increase window height."; }; } { action = ":resize -4"; key = "w-"; options = { silent = true; noremap = true; desc = "Decrease window height."; }; } { action = ":vertical resize +4"; key = "w]"; options = { silent = true; noremap = true; desc = "Increase window width."; }; } { action = ":vertical resize -4"; key = "w["; options = { silent = true; noremap = true; desc = "Decrease window width."; }; } { action = ":Bdelete!"; key = "bd"; options = { silent = true; noremap = true; desc = "Close buffer"; }; } { action = ":bprev"; key = "H"; options = { silent = true; noremap = true; desc = "Move to the previous buffer."; }; } { action = ":bnext"; key = "L"; options = { silent = true; noremap = true; desc = "Move to the next buffer."; }; } { action = ":Neogit"; key = "gg"; options = { silent = true; noremap = true; desc = "Open Neogit"; }; } { action = ":Neogit kind=floating commit"; key = "gc"; options = { silent = true; noremap = true; desc = "Quickly open Neogit commit menu"; }; } { mode = "n"; key = "]c"; action = { __raw = '' function() if vim.wo.diff then vim.cmd.normal({']c', bang = true}) else require('gitsigns').nav_hunk('next') end end ''; }; options = { silent = true; noremap = true; desc = "Go to next hunk"; }; } { mode = "n"; key = "[c"; action = { __raw = '' function() if vim.wo.diff then vim.cmd.normal({'[c', bang = true}) else require('gitsigns').nav_hunk('prev') end end ''; }; options = { silent = true; noremap = true; desc = "Go to previous hunk"; }; } { mode = "n"; key = "gs"; action = ":lua require('gitsigns').stage_hunk()"; options = { silent = true; noremap = true; desc = "Stage hunk"; }; } { mode = "n"; key = "gr"; action = ":lua require('gitsigns').reset_hunk()"; options = { silent = true; noremap = true; desc = "Reset hunk"; }; } { mode = "v"; key = "gs"; action = ":lua require('gitsigns').stage_hunk {vim.fn.line('.'), vim.fn.line('v')}"; options = { silent = true; noremap = true; desc = "Stage hunk"; }; } { mode = "v"; key = "gr"; action = ":lua require('gitsigns').reset_hunk {vim.fn.line('.'), vim.fn.line('v')}"; options = { silent = true; noremap = true; desc = "Reset hunk"; }; } { mode = "n"; key = "gS"; action = ":lua require('gitsigns').stage_buffer()"; options = { silent = true; noremap = true; desc = "Stage buffer"; }; } { mode = "n"; key = "gu"; action = ":lua require('gitsigns').undo_stage_hunk()"; options = { silent = true; noremap = true; desc = "Undo stage hunk"; }; } { mode = "n"; key = "gR"; action = ":lua require('gitsigns').reset_buffer()"; options = { silent = true; noremap = true; desc = "Reset buffer"; }; } { mode = "n"; key = "gp"; action = ":lua require('gitsigns').preview_hunk()"; options = { silent = true; noremap = true; desc = "Preview hunk"; }; } { mode = "n"; key = "gb"; action = ":lua require('gitsigns').blame_line{full=true}"; options = { silent = true; noremap = true; desc = "View line blame"; }; } { mode = "n"; key = "gB"; action = ":lua require('gitsigns').toggle_current_line_blame()"; options = { silent = true; noremap = true; desc = "Toggle line blame"; }; } { mode = "n"; key = "gd"; action = ":lua require('gitsigns').diffthis()"; options = { silent = true; noremap = true; desc = "Git diff"; }; } { mode = "n"; key = "gD"; action = ":lua require('gitsigns').diffthis('~')"; options = { silent = true; noremap = true; desc = "Git diff"; }; } { mode = "n"; key = "gtd"; action = ":lua require('gitsigns').toggle_deleted()"; options = { silent = true; noremap = true; desc = "Toggle git deleted"; }; } { action = ":split | wincmd j | resize 15 | term"; key = "tt"; options = { silent = true; noremap = true; desc = "Open a half-size horizontal terminal split"; }; mode = "n"; } { action = ":split | wincmd j | term"; key = "te"; options = { silent = true; noremap = true; desc = "Open a horizontal terminal split"; }; mode = "n"; } { action = ":vsplit | wincmd l | term"; key = "tv"; options = { silent = true; noremap = true; desc = "Open a vertical terminal split"; }; mode = "n"; } { action = ":Trouble diagnostics"; key = "xx"; options = { silent = true; noremap = true; desc = "View trouble diagnostics"; }; mode = "n"; } { action = ":Trouble symbols"; key = "xs"; options = { silent = true; noremap = true; desc = "View symbols"; }; mode = "n"; } { action = "(YankyPutAfter)"; key = "p"; mode = [ "n" "x" ]; } { action = "(YankyPutBefore)"; key = "P"; mode = [ "n" "x" ]; } { action = "(YankyGPutAfter)"; key = "gp"; mode = [ "n" "x" ]; } { action = "(YankyGPutBefore)"; key = "gP"; mode = [ "n" "x" ]; } { action = ":Telescope yank_history"; key = "fp"; mode = [ "n" "v" ]; options.desc = "Search through yank history with telescope."; } { action = '':Oil''; key = "e"; options = { desc = "Open oil file explorer in current nvim working directory"; noremap = true; silent = true; }; } { action = '':Oil''; key = "e"; options = { desc = "Open oil file explorer in current nvim working directory"; noremap = true; silent = true; }; } { action = '':lua vim.lsp.buf.code_action()''; key = "ca"; options = { desc = "View available code actions"; noremap = true; silent = true; }; } { action = '':lua vim.lsp.buf.rename()''; key = "cr"; options = { desc = "Rename symbol"; noremap = true; silent = true; }; } { action = '':lua require("lsp_lines").toggle()''; key = "cd"; options = { desc = "Toggle lsp lines"; noremap = true; silent = true; }; } { action = '':lua vim.lsp.codelens.run()''; key = "cl"; options = { desc = "Run codelens"; noremap = true; silent = true; }; } { action = '':Telescope ht hoogle_signature''; key = "fg"; options = { desc = "Search hoogle for under cursor"; noremap = true; silent = true; }; } { action = { __raw = '' function() require('conform').format() end ''; }; key = "cf"; options = { silent = true; noremap = true; desc = "Format buffer"; }; } { action = { __raw = '' function() -- we do this instead of `not vim.g.disable_autoformat` so that we -- can handle when `vim.g.disable_autoformat` has not yet been defined if (vim.g.disable_autoformat) then vim.g.disable_autoformat = false else vim.g.disable_autoformat = true end end ''; }; key = "ctf"; options = { silent = true; noremap = true; desc = "Toggle autoformat globally"; }; } { action = { __raw = '' -- we do this instead of `not vim.g.disable_autoformat` so that we -- can handle when `vim.g.disable_autoformat` has not yet been defined function() if (vim.b[0].disable_autoformat) then vim.b[0].disable_autoformat = false else vim.b[0].disable_autoformat = true end end ''; }; key = "cbf"; options = { silent = true; noremap = true; desc = "Toggle autoformat in buffer"; }; } { action = ":UndotreeToggle"; key = "u"; options = { noremap = true; desc = "Open undotree"; }; } ]; }