navigation.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. local demicolon = require('demicolon')
  2. local MiniBracketed = require('mini.bracketed')
  3. local Treewalker = require('treewalker')
  4. -- ,/; for bracket motions too
  5. demicolon.setup({
  6. keymaps = {
  7. disabled_keys = {
  8. -- this is paste with indent, not a motion
  9. 'p',
  10. -- we bind these to ; and ,
  11. ']',
  12. '[',
  13. }
  14. }
  15. })
  16. vim.keymap.set('n', ']]', ';', { remap = true })
  17. vim.keymap.set('n', '[[', ',', { remap = true })
  18. -- more bracket motions
  19. MiniBracketed.setup({
  20. -- some of our mappings and the builtin mappings overlap with these so enable
  21. -- only those we actually want to use
  22. buffer = { suffix = '' },
  23. comment = { suffix = '' },
  24. conflict = { suffix = '' },
  25. diagnostic = { suffix = '' },
  26. file = { suffix = '' },
  27. indent = { suffix = '' },
  28. jump = { suffix = '' },
  29. location = { suffix = '' },
  30. oldfile = { suffix = '' },
  31. quickfix = { suffix = '' },
  32. treesitter = { suffix = '' },
  33. window = { suffix = '' },
  34. yank = { suffix = '' },
  35. undo = { suffix = 'u' },
  36. })
  37. -- Treesitter navigation
  38. Treewalker.setup()
  39. vim.keymap.set({ 'n', 'v' }, '<C-k>', '<cmd>Treewalker Up<cr>')
  40. vim.keymap.set({ 'n', 'v' }, '<C-j>', '<cmd>Treewalker Down<cr>')
  41. vim.keymap.set({ 'n', 'v' }, '<C-h>', '<cmd>Treewalker Left<cr>')
  42. vim.keymap.set({ 'n', 'v' }, '<C-l>', '<cmd>Treewalker Right<cr>')
  43. -- jumplist navigation #bracketed
  44. vim.keymap.set('n', '[f', '<C-O>')
  45. vim.keymap.set('n', ']f', '<C-I>')
  46. -- window navigation #bracketed
  47. vim.keymap.set('n', '[w', '<C-w>W')
  48. vim.keymap.set('n', ']w', '<C-w>w')