-- [[ Basic Keymaps ]] -- Keymaps for better default experience -- See `:help vim.keymap.set()` vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) vim.keymap.set('n', 'pv', vim.cmd.Ex) -- Select and Drag vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") -- J without moving cursor vim.keymap.set('n', 'J', 'mzJ`z') -- Center cursor when jumping vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') -- Center cursor during search vim.keymap.set('n', 'n', 'nzzzv') vim.keymap.set('n', 'N', 'Nzzzv') -- Paste without yank vim.keymap.set('x', 'p', '\"_dP') -- Delete without yank vim.keymap.set({ 'n', 'v' }, 'd', '\"_d') -- no vim.keymap.set('n', 'Q', '') -- Format vim.keymap.set('n', 'f', function() vim.lsp.buf.format() end) -- Super substitute vim.keymap.set('n', 's', [[:%s/\<\>//gI]]) -- make current script executable vim.keymap.set('n', 'x', '!chmod +x %', { silent = true }) -- Remap for dealing with word wrap vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) vim.api.nvim_create_autocmd('TextYankPost', { callback = function() vim.highlight.on_yank() end, group = highlight_group, pattern = '*', }) -- Git stuff vim.keymap.set('n', 'gs', ":G status") vim.keymap.set('n', 'ga', ":G add %") vim.keymap.set('n', 'gc', [[:G commit -m ""]]) vim.keymap.set('n', 'gp', ":G push") -- vim: ts=2 sts=2 sw=2 et