You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

63 lines
2.5 KiB

local options = { noremap = true }
-- Don't copy "c" changes to primary register
vim.keymap.set('n', 'c', '"_c', options)
-- Easily open splits
vim.keymap.set('n', '<leader>hs', '<cmd>split<cr>', options)
vim.keymap.set('n', '<leader>vs', '<cmd>vsplit<cr>', options)
-- Copy the entire file
vim.keymap.set('n', '<leader>y', 'ggyG<C-o>', options)
vim.keymap.set('n', '<F5>', function() vim.cmd('mksession! ~/.cache//nvim/session/manual_session.vim') end, options)
vim.keymap.set('n', '<F6>', function() vim.cmd('source ~/.cache/nvim/session/manual_session.vim') end, options)
vim.keymap.set('n', '<F7>', function() vim.cmd('source ~/.cache/nvim/session/shutdown_session.vim') end, options)
-- Navigating with guides
vim.keymap.set('n', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options)
vim.keymap.set('v', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options)
-- Spell-check
vim.keymap.set('n', '<leader>o', '<cmd>setlocal spell! spelllang=en_au<cr>', options)
-- Keep highlight when indenting
vim.keymap.set('v', '<', '<gv', options)
vim.keymap.set('v', '>', '>gv', options)
vim.keymap.set('n', '<A-1>', '1gt', options)
vim.keymap.set('n', '<A-2>', '2gt', options)
vim.keymap.set('n', '<A-3>', '3gt', options)
vim.keymap.set('n', '<A-4>', '4gt', options)
vim.keymap.set('n', '<A-5>', '5gt', options)
vim.keymap.set('n', '<A-6>', '6gt', options)
vim.keymap.set('n', '<A-7>', '7gt', options)
vim.keymap.set('n', '<A-8>', '8gt', options)
vim.keymap.set('n', '<A-9>', '9gt', options)
vim.keymap.set('n', '<leader>gp', '<cmd>Git push<CR>', options)
vim.keymap.set('n', '<leader>gP', '<cmd>Git pull<CR>', options)
vim.keymap.set('n', '<leader>ga', '<cmd>Git add .<CR>', options)
vim.keymap.set('n', '<leader>gA', '<cmd>Git add<CR>', options)
vim.keymap.set('n', '<leader>gc', '<cmd>Git commit<CR>', options)
vim.keymap.set('n', '<leader>gC', '<cmd>Git commit -a<CR>', options)
vim.keymap.set("x", "<leader>p", "\"_dP", options)
vim.keymap.set("n", "<leader>d", "\"_d", options)
vim.keymap.set("v", "<leader>d", "\"_d", options)
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
vim.keymap.set('n', '<C-d>', '<C-d>zz')
vim.keymap.set('n', '<C-u>', '<C-u>zz')
vim.keymap.set('n', 'n', 'nzzzv')
vim.keymap.set('n', 'N', 'Nzzzv')
vim.keymap.set('n', '<C-k>', '<cmd>cnext<CR>zz')
vim.keymap.set('n', '<C-j>', '<cmd>cprev<CR>zz')
vim.keymap.set('n', '<leader>k', '<cmd>lnext<CR>zz')
vim.keymap.set('n', '<leader>j', '<cmd>cprev<CR>zz')
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])