{ vim = { globals.mapleader = " "; keymaps = [ { key = "s"; mode = "n"; silent = true; action = "lua MiniJump2d.start(MiniJump2d.builtin_opts.single_character)"; desc = "Jump2d"; } { key = "K"; mode = "n"; silent = true; action = "lua vim.lsp.buf.hover()"; desc = "LSP Hover"; } { key = ""; mode = "n"; silent = true; action = "bnext"; desc = "Next Buffer"; } # Format { key = "lf"; mode = "n"; silent = true; action = "lua require('conform').format({ async = true, lsp_format = 'fallback' })"; desc = "Format file"; } # Terminal { key = "tt"; mode = "n"; silent = true; action = "lua Snacks.terminal.toggle()"; desc = "Toggle terminal"; } { key = "tf"; mode = "n"; silent = true; action = "lua Snacks.terminal.toggle(nil, { style = 'float' })"; desc = "Toggle terminal (float)"; } { key = "tg"; mode = "n"; silent = true; action = "lua Snacks.lazygit()"; desc = "Lazygit"; } { key = "ts"; mode = "v"; silent = true; action = ":SttrTransform"; desc = "String Transform"; } { key = "tj"; mode = "n"; silent = true; action = ":JwtTui"; desc = "JWT TUI"; } { key = "tj"; mode = "v"; silent = true; action = ":JwtTuiOpen"; desc = "JWT TUI"; } # UI { key = "uw"; mode = "n"; silent = true; action = "set wrap!"; desc = "Toggle word wrapping"; } { key = "ul"; mode = "n"; silent = true; action = "set linebreak!"; desc = "Toggle linebreak"; } { key = "us"; mode = "n"; silent = true; action = "set spell!"; desc = "Toggle spellLazyGitcheck"; } { key = "uc"; mode = "n"; silent = true; action = "set cursorline!"; desc = "Toggle cursorline"; } { key = "un"; mode = "n"; silent = true; action = "set number!"; desc = "Toggle line numbers"; } { key = "ur"; mode = "n"; silent = true; action = "set relativenumber!"; desc = "Toggle relative line numbers"; } { key = "ut"; mode = "n"; silent = true; action = "set showtabline=2"; desc = "Show tabline"; } { key = "uT"; mode = "n"; silent = true; action = "set showtabline=0"; desc = "Hide tabline"; } # Todos { key = "xt"; mode = "n"; silent = true; action = "TodoTrouble"; desc = "Todo (Trouble)"; } # Shell { key = "!"; mode = "n"; silent = true; lua = true; desc = "Insert command output"; action = '' function() local cmd = vim.fn.input("Command: ") if cmd == "" then return end local lines = vim.fn.systemlist(cmd) while #lines > 0 and lines[#lines] == "" do table.remove(lines) end if #lines == 0 then return end vim.api.nvim_put(lines, "l", true, true) end ''; } { key = "!"; mode = "v"; silent = true; lua = true; desc = "Run command with selection"; action = '' function() local start_line = vim.fn.line("'<") local end_line = vim.fn.line("'>") local lines = vim.api.nvim_buf_get_lines(0, start_line - 1, end_line, false) local input_text = table.concat(lines, "\n") local cmd = vim.fn.input("$ ") if cmd == "" then return end local result = vim.fn.system({"bash", "-c", cmd}, input_text) local output = vim.split(result, "\n", { plain = true }) if output[#output] == "" then table.remove(output) end if #output == 0 then return end vim.api.nvim_buf_set_lines(0, start_line - 1, end_line, false, output) end ''; } # QOL { key = ">"; mode = "v"; silent = true; action = ">gv"; desc = "Indent and keep selection"; } { key = "<"; mode = "v"; silent = true; action = "