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.

47 lines
2.0 KiB

  1. local options = { noremap = true }
  2. -- Source init.lua
  3. vim.api.nvim_set_keymap('n', '<leader>so', '<cmd>source ~/.config/nvim/init.lua<CR>', options)
  4. -- Don't copy "c" changes to primary register
  5. vim.api.nvim_set_keymap('n', 'c', '"_c', options)
  6. -- Easily open splits
  7. vim.api.nvim_set_keymap('n', '<leader>hs', '<cmd>split<cr>', options)
  8. vim.api.nvim_set_keymap('n', '<leader>vs', '<cmd>vsplit<cr>', options)
  9. -- Copy the entire file
  10. vim.api.nvim_set_keymap('n', '<leader>y', 'ggyG<C-o>', options)
  11. -- Manually store session
  12. vim.api.nvim_set_keymap('n', '<F5>', '<cmd>mksession! ~/.cache//nvim/session/manual_session.vim<CR>', options)
  13. -- Restore manually stored session
  14. vim.api.nvim_set_keymap('n', '<F6>', '<cmd>source ~/.cache/nvim/session/manual_session.vim<CR>', options)
  15. -- Restore auto saved session created on exit
  16. vim.api.nvim_set_keymap('n', '<F7>', '<cmd>source ~/.cache/nvim/session/shutdown_session.vim<CR>', options)
  17. -- Replace all is aliased to S.
  18. vim.api.nvim_set_keymap('n', '<C-s>', '<cmd>%s//g<Left><Left>', options)
  19. -- Navigating with guides
  20. vim.api.nvim_set_keymap('n', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options)
  21. vim.api.nvim_set_keymap('i', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options)
  22. vim.api.nvim_set_keymap('v', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options)
  23. -- Spell-check
  24. vim.api.nvim_set_keymap('n', '<leader>o', '<cmd>setlocal spell! spelllang=en_au<cr>', options)
  25. -- Keep highlight when indenting
  26. vim.api.nvim_set_keymap('v', '<', '<gv', options)
  27. vim.api.nvim_set_keymap('v', '>', '>gv', options)
  28. -- Tab navigation
  29. vim.api.nvim_set_keymap('n', '<A-1>', '1gt', options)
  30. vim.api.nvim_set_keymap('n', '<A-2>', '2gt', options)
  31. vim.api.nvim_set_keymap('n', '<A-3>', '3gt', options)
  32. vim.api.nvim_set_keymap('n', '<A-4>', '4gt', options)
  33. vim.api.nvim_set_keymap('n', '<A-5>', '5gt', options)
  34. vim.api.nvim_set_keymap('n', '<A-6>', '6gt', options)
  35. vim.api.nvim_set_keymap('n', '<A-7>', '7gt', options)
  36. vim.api.nvim_set_keymap('n', '<A-8>', '8gt', options)
  37. vim.api.nvim_set_keymap('n', '<A-9>', '9gt', options)