mouse.vim 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. " Helper functions for generating mouse events
  2. let g:Ttymouse_values = ['sgr']
  3. let g:Ttymouse_dec = []
  4. let g:Ttymouse_netterm = []
  5. func MouseLeftClick(row, col)
  6. call nvim_input_mouse('left', 'press', '', 0, a:row - 1, a:col - 1)
  7. call getchar(1)
  8. call feedkeys('', 'x!')
  9. endfunc
  10. func MouseMiddleClick(row, col)
  11. call nvim_input_mouse('middle', 'press', '', 0, a:row - 1, a:col - 1)
  12. call getchar(1)
  13. call feedkeys('', 'x!')
  14. endfunc
  15. func MouseRightClick(row, col)
  16. call nvim_input_mouse('right', 'press', '', 0, a:row - 1, a:col - 1)
  17. call getchar(1)
  18. call feedkeys('', 'x!')
  19. endfunc
  20. func MouseCtrlLeftClick(row, col)
  21. call nvim_input_mouse('left', 'press', 'C', 0, a:row - 1, a:col - 1)
  22. call getchar(1)
  23. call feedkeys('', 'x!')
  24. endfunc
  25. func MouseCtrlRightClick(row, col)
  26. call nvim_input_mouse('right', 'press', 'C', 0, a:row - 1, a:col - 1)
  27. call getchar(1)
  28. call feedkeys('', 'x!')
  29. endfunc
  30. func MouseAltLeftClick(row, col)
  31. call nvim_input_mouse('left', 'press', 'A', 0, a:row - 1, a:col - 1)
  32. call getchar(1)
  33. call feedkeys('', 'x!')
  34. endfunc
  35. func MouseAltRightClick(row, col)
  36. call nvim_input_mouse('right', 'press', 'A', 0, a:row - 1, a:col - 1)
  37. call getchar(1)
  38. call feedkeys('', 'x!')
  39. endfunc
  40. func MouseLeftRelease(row, col)
  41. call nvim_input_mouse('left', 'release', '', 0, a:row - 1, a:col - 1)
  42. call getchar(1)
  43. call feedkeys('', 'x!')
  44. endfunc
  45. func MouseMiddleRelease(row, col)
  46. call nvim_input_mouse('middle', 'release', '', 0, a:row - 1, a:col - 1)
  47. call getchar(1)
  48. call feedkeys('', 'x!')
  49. endfunc
  50. func MouseRightRelease(row, col)
  51. call nvim_input_mouse('right', 'release', '', 0, a:row - 1, a:col - 1)
  52. call getchar(1)
  53. call feedkeys('', 'x!')
  54. endfunc
  55. func MouseLeftDrag(row, col)
  56. call nvim_input_mouse('left', 'drag', '', 0, a:row - 1, a:col - 1)
  57. call getchar(1)
  58. call feedkeys('', 'x!')
  59. endfunc
  60. func MouseWheelUp(row, col)
  61. call nvim_input_mouse('wheel', 'up', '', 0, a:row - 1, a:col - 1)
  62. call getchar(1)
  63. call feedkeys('', 'x!')
  64. endfunc
  65. func MouseWheelDown(row, col)
  66. call nvim_input_mouse('wheel', 'down', '', 0, a:row - 1, a:col - 1)
  67. call getchar(1)
  68. call feedkeys('', 'x!')
  69. endfunc
  70. func MouseWheelLeft(row, col)
  71. call nvim_input_mouse('wheel', 'left', '', 0, a:row - 1, a:col - 1)
  72. call getchar(1)
  73. call feedkeys('', 'x!')
  74. endfunc
  75. func MouseWheelRight(row, col)
  76. call nvim_input_mouse('wheel', 'right', '', 0, a:row - 1, a:col - 1)
  77. call getchar(1)
  78. call feedkeys('', 'x!')
  79. endfunc
  80. " vim: shiftwidth=2 sts=2 expandtab