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.

83 lines
2.6 KiB

  1. local options = { noremap = true }
  2. -- Source init.lua
  3. vim.api.nvim_set_keymap('n',
  4. '<leader>so',
  5. '<cmd>source ~/.config/nvim/init.lua<CR>',
  6. options
  7. )
  8. -- Don't copy "c" changes to primary register
  9. vim.api.nvim_set_keymap('n', 'c', '"_c', options)
  10. -- Easily open splits
  11. vim.api.nvim_set_keymap('n', '<leader>hs', '<cmd>split<cr>', options)
  12. vim.api.nvim_set_keymap('n', '<leader>vs', '<cmd>vsplit<cr>', options)
  13. -- Copy the entire file
  14. vim.api.nvim_set_keymap('n', '<leader>y', 'ggyG<C-o>', options)
  15. -- Manually store session
  16. vim.api.nvim_set_keymap(
  17. 'n',
  18. '<F5>',
  19. '<cmd>mksession! ~/.cache//nvim/session/manual_session.vim<CR>',
  20. options
  21. )
  22. -- Restore manually stored session
  23. vim.api.nvim_set_keymap('n',
  24. '<F6>',
  25. '<cmd>source ~/.cache/nvim/session/manual_session.vim<CR>',
  26. options
  27. )
  28. -- Restore auto saved session created on exit
  29. vim.api.nvim_set_keymap('n',
  30. '<F7>',
  31. '<cmd>source ~/.cache/nvim/session/shutdown_session.vim<CR>',
  32. options
  33. )
  34. -- Replace all is aliased to S.
  35. vim.api.nvim_set_keymap('n', '<C-s>', '<cmd>%s//g<Left><Left>', options)
  36. -- Navigating with guides
  37. vim.api.nvim_set_keymap('n',
  38. '<leader><leader>',
  39. '<Esc>/<++><Enter>"_c4l',
  40. options
  41. )
  42. vim.api.nvim_set_keymap('v',
  43. '<leader><leader>',
  44. '<Esc>/<++><Enter>"_c4l',
  45. options)
  46. -- Spell-check
  47. vim.api.nvim_set_keymap('n',
  48. '<leader>o',
  49. '<cmd>setlocal spell! spelllang=en_au<cr>',
  50. options)
  51. -- Keep highlight when indenting
  52. vim.api.nvim_set_keymap('v', '<', '<gv', options)
  53. vim.api.nvim_set_keymap('v', '>', '>gv', options)
  54. vim.api.nvim_set_keymap('n', '<A-1>', '1gt', options)
  55. vim.api.nvim_set_keymap('n', '<A-2>', '2gt', options)
  56. vim.api.nvim_set_keymap('n', '<A-3>', '3gt', options)
  57. vim.api.nvim_set_keymap('n', '<A-4>', '4gt', options)
  58. vim.api.nvim_set_keymap('n', '<A-5>', '5gt', options)
  59. vim.api.nvim_set_keymap('n', '<A-6>', '6gt', options)
  60. vim.api.nvim_set_keymap('n', '<A-7>', '7gt', options)
  61. vim.api.nvim_set_keymap('n', '<A-8>', '8gt', options)
  62. vim.api.nvim_set_keymap('n', '<A-9>', '9gt', options)
  63. vim.api.nvim_set_keymap('n', '<leader>gp', '<cmd>Git push<CR>', options)
  64. vim.api.nvim_set_keymap('n', '<leader>gP', '<cmd>Git pull<CR>', options)
  65. vim.api.nvim_set_keymap('n', '<leader>ga', '<cmd>Git add .<CR>', options)
  66. vim.api.nvim_set_keymap('n', '<leader>gA', '<cmd>Git add<CR>', options)
  67. vim.api.nvim_set_keymap('n', '<leader>gc', '<cmd>Git commit<CR>', options)
  68. vim.api.nvim_set_keymap('n', '<leader>gC', '<cmd>Git commit -a<CR>', options)
  69. vim.api.nvim_set_keymap("x", "<leader>p", "\"_dP", options)
  70. vim.api.nvim_set_keymap("n", "<leader>d", "\"_d", options)
  71. vim.api.nvim_set_keymap("v", "<leader>d", "\"_d", options)